-3

So, I just wanted to make a counter for #StopTheFire Which how can I extract the number from <span>? I also saw some post on twitter asking about this. With JavaScript. Can I use WrapAPI for this? Thanks.

Part of the code from StopTheFire.gg:

<span>$25,692</span>

Photo

Nick Parsons
  • 45,728
  • 6
  • 46
  • 64
Win
  • 17
  • 3

1 Answers1

0

Get the html of the site

Use jQuery:

$.ajax({ url: 'your-url', success: function(data) { alert(data); } });

This data is your HTML.

.getElementsByTagName("span") will return you a collection of elements. Here you might have to parse first and select by id or class because there will be wrong spans...

Then, you might want to use .innerHTML:

For your case you would just loop through

var spans = document.getElementsByTagName("span");

and for each of those

var array_values = []
var value;
for(key in spans) {
 value = spans[key].innerHTML;
 array_values.push(value)
}
lehm.ro
  • 750
  • 4
  • 16