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 >
You might want to try the contains selector:
contains
if ($("#field > div.field-item:contains('someText')").length) { $("#somediv").addClass("thisClass"); }
Also, as other mentioned, you must use == or === rather than =.