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 help.
<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 help.
Comment