What’s the easiest way to search a div for a text string using jquery? I specifically want to search a div with an id and see if it contains $(this).text(). The purpose of this is to be able to append elements to a div but be able to prevent the same string from being written to the same div over and over.
What’s the easiest way to search a div for a text string using jquery?
Share
I think I’d probably go with
String#indexOf: