javascript - $(this).addClass() not working -


I can do $ (this). Children ("a") AddClass ("class") and it works fine, but when I do $ (this) .addClass ("class") this is not working I have a mouseover function I am using $ (this) inside.

  $ ("# site nav li.hasChild") Mouse ("function") {$ (this). Children ("a"). AddClass ("selectedTab"); // fine $ (this) works. AddClass ("selectedFixTab"); // $ (this) work Children ("ul"). CSS ("display area");});   

HTML:

  & lt; Header id = "site" & gt; & Lt; NAV & gt; & Lt; Ul & gt; & Lt; Li id = "li1" class = "hasil" & gt; & Lt; A href = "#" & gt; Fix & lt; / A & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; 1 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; 2 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; 3 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; 4 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; 5 & ​​lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; Li id = "li2" class = "hatchil" & gt; & Lt; A href = "#" & gt; Learn & lt; / A & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; 1 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; 2 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; 3 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; 4 & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; Li id = "Li3" & gt; & Lt; A href = "contact.htm" & gt; Contact & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Neo & gt; & Lt; / Header & gt;   

CSS:

 . SelectedfixTab {border-top: 1px solid # eb7c00; Border-left: 1 px solid # eb 7c 00; Border-right: 1 px solid # eb 7c 00; }. Select LearnTab {border-top: 1px solid # 2d70a3; Border-left: 1px solid # 2d70a3; Border-right: 1px solid # 2d70a3; }. SelectedTab {border below: 1px solid #fff; }   

This successfully adds the "selectedFixTab" class As soon as the mouse wiggles the top-level LI tag on the light tag. You can see it in action in this JSFDell:.

I'm not sure that he is actually planning for you, but it is doing what the code says. If you are trying to fulfill it, then we can help you to fix the code to do so.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -