Test if element exists jquery -


I am trying to see if any of these is present in uls. I tested it. Length but I'm not sure I'm doing this right. This is alerts, even if there is no one with the selected sub-domain class.

  if ($ ('ul.expul & gt; li.select-sub-domain'). Length & lt; 0) {var sub_doma = "set is not" ; Warning ("no"); } And {warnings ("yes"); Var all_domain = $ ('li.select-sub-domain'). Attr ('id'); Var sub_domainSplit = sub_domain.split ('-'); Var all_dom = all_domain split [1]; } & Lt; Ul class = "one expo" & gt; & Lt; Li class = 'select' id = eng-88> 1 & lt; / Li & gt; & Lt; Li class = 'Select' id = IN-89 & gt; 2 & lt; / Li & gt; & Lt; Li class = 'Select' id = eng-90 & gt; 3 & lt; / Li & gt; & Lt; Li class = 'Select' id = ins-91 & gt; 4 & lt; / Li & gt; & Lt; Li class = 'select' id = eng-92 & 5; 5 & ​​lt; / Li & gt; & Lt; Li class = 'select' id = eng-93 & gt; 6 & lt; / Li & gt; & Lt; Li class = 'selection' id = ing-94 & gt; 7 & lt; / Li & gt; & Lt; Li class = 'selection' id = ing-95 & gt; 8 & lt; / Li & gt; & Lt; Li class = 'select' id = ing-96 & gt; 9 & lt; / Li & gt; & Lt; Li class = 'selection' id = IN-97 & gt; 10 & lt; / Li & gt; & Lt; Li class = 'select' id = ins-98 & gt; 11 & lt; / Li & gt; & Lt; Li class = 'select' id = eng-99 & gt; 12 & lt; / Li & gt; & Lt; / Ul & gt; & Lt; Ul class = "hide two exposures" & gt; & Lt; Li class = 'select' id = wing-100 & gt; 1 & lt; / Li & gt; & Lt; Li class = 'Select' id = wing-0101 & gt; 2 & lt; / Li & gt; & Lt; Li class = 'select' id = fin-102 * 3 & lt; / Li & gt; & Lt; Li class = 'select' id = fin-104> 4 & lt; / Li & gt; & Lt; Li class = 'select' id = fin-104 * 5 & ​​lt; / Li & gt; & Lt; Li class = 'select' id = fin -100 & gt; 6 & lt; / Li & gt; & Lt; Li class = 'select' id = wing-102 & gt; 7 & lt; / Li & gt; & Lt; Li class = 'select' id = wing-107 & gt; 8 & lt; / Li & gt; & Lt; / Ul & gt; & Lt; Ul class = "hide three exposures" & gt; & Lt; Li class = 'selection' id = three-108 & gt; 1 & lt; / Li & gt; & Lt; Li class = 'selection' id = three-109 & gt; 2 & lt; / Li & gt; & Lt; Li class = 'selection' id = three -1010; 3 & lt; / Li & gt; & Lt; Li class = 'selection' id = three111 & gt; 4 & lt; / Li & gt; & Lt; Li class = 'selection' id = three112 & gt; 5 & ​​lt; / Li & gt; & Lt; Li class = 'select' id = three-113 & gt; 6 & lt; / Li & gt; & Lt; / Ul & gt;  

change $ ('ul.expul & gt; Li.select -sub-domain '). Length & gt; 0)

to $ ('ul.expul & gt; li.select-sub-domain'). Length == 0)

You are the code like length greater than 0, warning number Which is not right.

This should not be shown when the length is equal to 0.


Comments

Popular posts from this blog

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -