jquery - Select child element of previous element -
How do I go about selecting the basic element of the previous element I know how to use the previous primary element .prev (), but how did I choose the element of that last element, so that I can modify CSS? Thanks for any help.
jQuery:
$ ("li.selected"). Prev () CSS ("border-right", "none");
Edit:
I want the element to apply the CSS style with only the "selected" category before the element. Currently all elements are being CSS selector application Are there. Thank you.
& lt; Ul id = "nav_1510737" & gt; & Lt; Li & gt; & Lt; A href = "about /" & gt; About & lt; / A & gt; & Lt; / Li & gt; & Lt; Li class = "selected" & gt; & Lt; A href = "/ bookkeeping" & gt; Bookkeeping & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "/ ms-office-support" & gt; MS Office Support & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "/ office-organization" & gt; Office organization & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "/ virtual-services" & gt; Virtual Service & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "/ grant-writing" & gt; Grant writing & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "/ contact" & gt; Contact & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt;
You can use :
$ ("li.selected"). East (). Children () CSS ("border-right", "none");
Please note that .bildren ()
leads only to a level below the parental node, if you want to face many levels, then you < Strong> :
$ ("li.selected"). Prev () ('*'). CSS ("border-right", "none");
Comments
Post a Comment