I would like to have a submit button which contains text and an image. Is this possible?
I can get the exact look I want with code that looks like:
<button type="button">
<img src="save.gif" alt="Save icon"/>
<br/>
Save
</button>
... but I haven't found a way to have one of those for my forms. Is there a way to do that with an
<input type="submit" ...>
element? Or am I forced to go the image or text way? Thanks for your help!
input type="submit"
is the best way to have a submit button in a form. The downside of this is that you cannot put anything other than text as its value. The button element can contain other HTML elements and content.Try putting
type="submit"
instead oftype="button"
in yourbutton
element (source).Pay particular attention however to the following from that page:
I have found a very easy solution! If you have a form and you want to have a custom submit button you can use some code like this:
Or just direct it to a link of a page.
Please refer to this link. You can have any button you want just use javascript to submit the form
http://www.w3schools.com/jsref/met_form_submit.asp
You're really close to the answer yourself
Or, you can just remove the type-attribute
<input type="button" id="btnTexWrapped" style="background:
url('http://i0006.photobucket.com/albums/0006/findstuff22/Backgrounds/bokeh2backgrounds.jpg');background-size:30px;width:50px;height:3em;" />
Change input style elements as you want to get the button you need.
I hope it was helpful.
Very interesting. I have been able to get my form to work but the resulting email displays:
imageField_x: 80 imageField_y: 17
at the bottom of the email that I get.
Here's my code for the buttons.
Maybe this will help you and me as well.
:-)