jQuery - Create element and append to all links, except some

jquery

Solution

It should be

$('<span/>',{
    'class': 'im'
    }).appendTo($('a').not(".nav ul > li > a"));

Demo: Fiddle

Problem

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.

Original source