Tuesday, 15 June 2010

jquery - detect link in 2nd level li and add a span, plus add class to parent li on hover -


I am working on a unordered list menu at a two level, and taking some good newbie steps to figure out so far

  1. I want to be a parent
  2. I would like to know whether the parent is a li, and adds a span between a tag , As a result: & lt; A href = "#" & gt; Text & lt; Span style = "addedStyle" & gt; & Amp; Nbsp; & Lt; / Span & gt; & Lt; / A & gt;

Here I am using jQuery. ".addClass (" active ")" does not seem to be doing much:

  $ ("LeftMenu li: is ('ul')"). Hover (function {$ (This) .addClass ("Active"). Children (). ({Opacity: 'Show'});}, Function () {$ (this) .removeClass ("Active") Children (hide) ();}); // This line is incorrect and non-functional $ (". LeftMenu li: is ('ul & gt; a')"). Attachment ('& lt; span class = "arrowdiv" & gt; & amp; nbsp; & lt; / span & gt;');  

Looking forward!

Understand it something new every day!

I wanted to find "A" and to add it to it was completely attached to the whole li, and I had to pay attention to that which I clearly did:

< Pre> $ ("LeftMenu li: has ('ul')> one). Attachment ('& lt; span class = "arrowdiv" & gt; & amp; nbsp; & lt; / span & gt;'). Parent (). Hover (function {$ (this) .addClass ("active"). (Child) (). ();} ());}

No comments:

Post a Comment