By passing div id, can i change target of text replacement?

Posted by crosenblum on Stack Overflow See other posts from Stack Overflow or by crosenblum
Published on 2010-03-29T20:16:17Z Indexed on 2010/03/29 20:23 UTC
Read the original article Hit count: 256

I am using the code below to replace text inside a div. But I need to loop through a specific div, instead of everything on the page, that is the div's text nodes...

I just do not understand how to refer to the div in the code below.

    (function (parent) {
var childs = parent.childNodes;

// if there are children to this
if (childs && childs.length) {

    // loop through each text node
    for (var i = 0, node; node = childs[i]; i++) {

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery