Add href to all img jQuery

This simple function will add a href to all images on your page and link them to the img src
[js]
$(‘img’).each(function ()
{
var currImg = $(this); // cache the selector
currImg.wrap(““);
});
[/js]

It is also possible to only append href to images with a certain class or in a specific div
[js]
$(“.myDiv”).find(‘img’).each(function () {
var currImg = $(this); // cache the selector
currImg.wrap(““);
});
[/js]

I have used this option to load images with Lightbox2, using the following code
[js]
$(“.myDiv”).find(‘img’).each(function () {
var currImg = $(this); // cache the selector
currImg.wrap(““);
});
[/js]