Expand it manually with each (), for example:
$("a[href*=site.com/img/]").each (function () {
$(this).after("<img src="+$(this).attr("href")+">");
});
You need to be in the right area for $ (this) in order to behave as you expect, jQuery needs some kind of context to set it up.
source
share