Donjwan Donjwan - 2 months ago 6
Javascript Question

changing a value of a html tag

I am using inside my page 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

thanks

Answer

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. :)