title: jQuery: Easiest way to wrap an image tag with an A anchor tag
body: <p>This is a simplified version of my problem. </p>
  
  <p>I have two buttons, and one image. The image code is something like this</p>
  
  <pre><code>&lt;img class="onoff" src="image.jpg"&gt;
  </code></pre>
  
  <p>When I press button one I want the image to be wrapped in an A tag, like</p>
  
  <pre><code>&lt;a href="link.html"&gt;
  &lt;img class="onoff" src="image.jpg"&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>And when I press the other button, the A tags should be removed. </p>
  
  <p>What's the easiest way of doing this with jQuery?</p>