How to replace a button with an image?

advertisements

I'm creating a floating sidebar which will display Facebook logo and open a div on click. This div will contain a Facebook like box. When the user clicks the logo again, the div closes.

I managed to get it working, but I need to replace the button with an image (Facebook logo, like I said) and still have the functionality of this script.

How could I achieve this?

Fiddle here: http://jsfiddle.net/h8CNP


Your Javascript is set to toggle based on the click of the id so all you would need to do is replace this:

<button id="show1" data-href="curtir">Click ME!</button>

With this:

<img id="show1" src="whatever.jpg" data-href="curtir" />

Here is a fiddle of it in action: http://jsfiddle.net/LrTqG/