I am having trouble getting the inner text of a particular node. I have added the example node I am working with and the javascript I have come up with. The javascript works as far as returning this <span id=\"goal_left\">3 goals lect</span> if i log it to the console. If i add innerText to the javascript examples it will return nothing to the console. Any ideas how to get this text?
html
<span id=\"goal_left\">3 goals lect</span>
javascript: these examples return <span id=\"goal_left\">3 goals lect</span>
document.getElementById(\"goal_left\");
document.querySelectorAll(\"span#goal_left\")[0];
javascript: these examples return nothing
document.getElementById(\"goal_left\").innerText;
document.querySelectorAll(\"span#goal_left\")[0].innerText;





Rating:
The post javascript – getting the inner text of a node appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/javascript-getting-the-inner-text-of-a-node.html
No comments:
Post a Comment