I found it.
I should use document.getEle mentById('test' ).innerHTML;
User Profile
Collapse
-
How to get the value of an id
I'm trying to get the value of an id. This is my code:
<span id="test">this value</span>
<script type="text/javascript">
var myVal = document.getEle mentById('test' ).value;
alert(myVal);
</script>
When I run it I get "undefined" in the alert window.
How can I get the value "this value" from the span?
Please...
No activity results to display
Show More
Leave a comment: