I am using inside my page <span>
tag like this
<span class="class_name">1500</span>
and I have a javascript code who change "1500" to 15%
my question is how to read the number inside the span and print the new number
I want an example code.
I am using inside my page <span>
tag like this
<span class="class_name">1500</span>
and I have a javascript code who change "1500" to 15%
my question is how to read the number inside the span and print the new number
I want an example code.
you can try
var number = parseInt(document.querySelector('span.class_name').innerHTML);
try this
<span id="thisspan" class="whateverclass">1500</span>
<div id="thevalueis"></div>
<script>
document.getElementById("thevalueis").innerHTML=document.getElementById("thisspan").innerHTML;
</script>
I hope i got your question right. :)