2

I have a simple form with a submit button. I would like to use the submit button using an image something like,

<INPUT TYPE="image" SRC="images/submit.gif" HEIGHT="30" WIDTH="173" BORDER="0" ALT="Submit Form">

How can I use the image as submit button? Then what I want to change in jquery initialisation?

<form action='#' id='freeForm' method='post' autocomplete="off">
<a> 
<input style='border: none' type='submit' value='Submit' /> 
</a>
</form>

jQuery

$("#freeForm").submit(function()
    {
    });

Thanks!

2
  • <input type="image" name="submitbtn" src="images/submit.gif">
    – mack
    Jun 7, 2012 at 6:01
  • @mack: You should post that as an answer
    – Ayush
    Jun 7, 2012 at 6:02

3 Answers 3

2

jQuery isn't necessary, as an image button already submits a form.

<form>
    <input type="image" src="foo.png" />
</form>

Fiddle: http://jsfiddle.net/jonathansampson/AkR95/

1

u can do some thing like this

$("#image").onclick(function()
    {
$("#freeForm").submit();
    });

#image is the id of element containing your image.

0
0

Try this one:

<input type="submit" value="Enter" name="submit" style="background:url('/imgBG.jpg') no-repeat;width:100;height:50;border:none;"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.