Html – How to give html button tag an image

buttonhtml

I am wondering if there is a way to give the HTML button tag, <button> an image so the image is click-able on my webpage. That way when users click on the image I can have other things happen

This doesn't seem to be working, and was wondering if it is even possible

HTML code –

<button>
<img src="images/dagger.png" width="10%" height="10%" id="dagger" />
</button>

Best Solution

Not quite sure what you are trying to achieve but maybe this example helps.

HTML

<button>
<img src="http://www.w3.org/html/logo/downloads/HTML5_Logo_32.png" id="dagger" />
</button>

JavaScript

$(function(){
    $("#dagger").click(function(){
        alert("click");
    }); 
});