[jQuery] Help with ".each"

[jQuery] Help with ".each"


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($("a[@href*=mysite]"));
for(i=0;i<getLinks.length;i++){$("<div>

Lorem
Ipsum

</div>").insertAfter(getLinks[i]);}
but I'm having trouble converting it all to jQuery using ".each":
$("a").not($("a[@href*=mysite]")).each(function()
{$(this).html("<div>

Lorem Ipsum

</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#a9319633
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/