Turn off an element based on text existing in an unrelated element on page using JQuery -


I have to close a specific DIV on the page based on the presence of a particular text which is not (or not) on the page Someone else is sitting inside a tag ...

In the simplified case below, if the text contains 'specific-text', then I will div the 'dependent'

  & lt; Div & gt; & Lt; Table class = "mytable" & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; Ul & gt; Test for specific-text & lt; / Ul & gt; & Lt; / TD & gt; & Lt; TR & gt; & Lt; / Table & gt; & Lt; / Div & gt; ... many other stuff is going on ... & lt; Div class = "dependent" & gt; I want to show or not show the DIV given here based on the format of 'specific-text' text; & Lt; / Div & gt;    

  var specificText = ""; If ((($ '(' + specific text + '' ') in length ($ (' $ '. Length & gt; 0) $ (' div.dependent ') Show ();    

Comments