get string of element

JavaScript
var x = document.getElementById("myBtn").textContent; 
Source

Also in JavaScript: