Get the value of a textnode which is being shown on the screen via javascript.Not very easy
I mean, assume a web page is very long and contain lots of words, now i just want to get the value of a textnode which is being shown on the screen.How could i do it? Thanks! :)
what's more: I mean, i know how to get the value of a textnode,but if a web page is very lage and contains thousands of words, what i want to do is that,only get the shown t开发者_Python百科extnode of the dom tree.That means if you slither a mouse wheel,some text disappear and some come into your vision.
See the textContent
(DOM) and innerText
(IE) properties.
Or, in jQuery, use $(elem).text();
var item = document.getElementById('elementId'); alert(item.value);
精彩评论