How can I check if a div contains a certain word?
var divs= document.getElementsByTagName('div');
for (var i = 0, len = divs.length; i < len; ++i) {
if (divs[i].text = '*word*'){
//do somthing
}
}
doesn't work.
use the indexOf function
if(divs[i].innerHTML.indexOf("word") !== -1) {
// something
}