I have this document structure
<div id="log">
<div>ABC</div>
<br/>
<div>DEF</div>
<br/>
...
</div>
Where ...
represents any number of div, br pairs.
Now I need to write a JQuery function called exists that takes an id (in this case "log") and a string (for example "DEF") and checks if in the "log" div there is any div whose text matches "DEF". My JQuery is weak, can someone help me with this?
if ( $('#log div:contains("DEF")').length ) {
// exists
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With