Hick
Hick

Reputation: 36394

How to create an image button in a form in twitter boostrap?

Currently, I've images such as this:

    <img src="xyz.jpg"  width="80" height="80" id = "wp" alt="wp">
 <img src = "abc.jpg"  width="80" id = "tm" height="80" alt="tm">

and then writing the onclick on it:

$('img#wp').click(function() {


});

The problem with this is I'm not able to use this to insert a value into a form depending upon the image that has been clicked. Nor do the image show up as button, thus not exactly responsive for mobiles and tablets. How to go about it?

Upvotes: 0

Views: 76

Answers (2)

rails_id
rails_id

Reputation: 8220

You could use an image submit button

<input type="image" src="http://www.luvvitt.com/skin/frontend/default/luvvitt/images/submit.png" alt="Submit Form" class="btn"/>

Upvotes: 0

Axel
Axel

Reputation: 10772

You can use <button> to submit forms, and also include an image tag inside of the button

<button name="buttonName" value="buttonValue" type="submit">
   <img src="xyz.jpg" alt="" />
</button>

Upvotes: 1

Related Questions