I\'m trying to check in jQuery if a div contains some text, and then add a class if it does.
So I wrote something like this:
if( $(\"#field >
Why not simply
var item = $('.field-item'); for (var i = 0; i <= item.length; i++) { if ($(item[i]).text() == 'someText') { $(item[i]).addClass('thisClass'); //do some other stuff here } }