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!

Sampson
269k76 gold badges546 silver badges570 bronze badges
asked Jun 7, 2012 at 5:57
2
  • <input type="image" name="submitbtn" src="images/submit.gif"> Commented Jun 7, 2012 at 6:01
  • @mack: You should post that as an answer Commented 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/

answered Jun 7, 2012 at 6:00
Sign up to request clarification or add additional context in comments.

Comments

1

u can do some thing like this

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

#image is the id of element containing your image.

Rudie
54.2k42 gold badges137 silver badges176 bronze badges
answered Jun 7, 2012 at 6:02

Comments

0

Try this one:

<input type="submit" value="Enter" name="submit" style="background:url('/imgBG.jpg') no-repeat;width:100;height:50;border:none;"/>
answered Jun 7, 2012 at 6:05

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.