Inside a function valled by .each I want to remove the a tag(s)/.
Here is a non-working example:
$('div.link').has('div.entry:has(p.title:has(a[href^="http://i.imgur.com/"]))').each(function (i) {
$(this).css('border', '5px solid');
$(this).remove('a'); // Does NOT work! Nothing happens...
console.log($(this));
})
Click image below for full size. The marked line is pure coincidence and indicates nothing. To test stuff out, visit http://reddit.com and use Firebug (jQuery is loaded):

Provide
thisas the context:The second parameter to the
$function is often times thecontextfor your selector, meaning the area in which you’d like to find matches to your selector. In this particular case, we’re saying we’d like to findaelements withinthis.jQuery will internally convert this to a find call:
So if you don’t mind a slightly more verbose solution (a few chars, no big deal), you can pick up a very negligible performance boost by cutting out the middle-man syntax and using
.finddirectly.