Reputation: 1872
The style of the pages I'm building is to have a little triangle after each link. As such, I've built a little script that appends a <span> after each link.
I'm creating a new span, with a class and appending it to all anchors, but I don't want it do to it in the nav anchors.
Of course, I can just hide the appended spansin css for those I don't want, but surely I can just tweak what I have:
$('<span/>',{
'class': 'im'
}).appendTo('a').not(".nav ul > li > a");
The not() part isn't working.
Upvotes: 3
Views: 112
Reputation: 388316
It should be
$('<span/>',{
'class': 'im'
}).appendTo($('a').not(".nav ul > li > a"));
Demo: Fiddle
Upvotes: 7
Reputation: 51850
The not
part should be in the 'a'
selector :
...
.appendTo('a:not(.nav ul > li > a)')
I would suggest that you tag your a
anchors somehow, to simplify the work of the selector, for example :
navLink
class to a
s in the .nav
bar,'a:not(.navLink)'
, and selecting the nodes will involve less work from jQueryUpvotes: 1