I have a counter on a website whose value I'd like to access using Javascript.
The code I'm trying to reference looks like this:
<span id="counter">
0123 // This is the value I'm trying to access
</span>
What would be the best way to easily access this value? Screen scraping seems to be overly complex. Thanks!
var el = document.getElementById('counter'),
// innerText for IE, textContent for other browsers.
value = el.textContent || el.innerText || '';
alert(value);