You might try: $("a").not($("[EMAIL PROTECTED]")).each(function() {$(this).after("<div><p>Lorem Ipsum</p></div>");});
Yansky wrote: > > I'm trying to insert a div after all < a > elements that don't link to my > site. My script is currently working like this: > > var getLinks = $("a").not($("[EMAIL PROTECTED]")); > for(i=0;i<getLinks.length;i++){$("<div><p>Lorem > Ipsum</p></div>").insertAfter(getLinks[i]);} > > but I'm having trouble converting it all to jQuery using ".each": > > $("a").not($("[EMAIL PROTECTED]")).each(function() > {$(this).html("<div><p>Lorem Ipsum</p></div>").insertAfter();}); > > The function only gives the raw DOM right? Not the jQuery object. So I > have to use $(this) to access the jQuery objects again right? > > At the moment, the ".each" version inserts the div as a child node, rather > than as a sibling (which is what I'm after). > -- View this message in context: http://www.nabble.com/Help-with-%22.each%22-tf3351407.html#a9319828 Sent from the JQuery mailing list archive at Nabble.com. _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/