Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js find all text elements

function textNodesUnder(node){
  var all = [];
  for (node=node.firstChild;node;node=node.nextSibling){
    if (node.nodeType==3) all.push(node);
    else all = all.concat(textNodesUnder(node));
  }
  return all;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #find #text #elements
ADD COMMENT
Topic
Name
3+1 =