javascript - $(this).addClass() not working -
I can do HTML: CSS: This successfully adds the 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. $ (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");});
& 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;
. 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; }
"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:.
Comments
Post a Comment