Wrapping a html tag with an additional html tag.

Wrapping a html tag with an additional html tag.

I would like to use JS to grab all images and make them links.

  1. <img class="GrabMe" src="./X.jpg" alt="Alternate Text"/>

into

  1. <a rel="Image" href="./X.jpg" title="Alternate Text" > <img class="GrabMe" src="./X.jpg" alt="Alternate Text"/> </a>

Can someone help me understand how to do this for every img.GrabMe? I really don't understand how to wrap a tag with another tag.

Thank you so very much in advance.