This is a simplified version of my problem.
I have two buttons, and one image. The image code is something like this
Try something like this:
$("img.onoff").wrap( $("").attr("href", "link.html"));
But perhaps using jQuery's click binding on the image itself would be better than wrapping the image in an anchor.