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!
3 Answers 3
jQuery isn't necessary, as an image button already submits a form.
<form>
<input type="image" src="foo.png" />
</form>
answered Jun 7, 2012 at 6:00
Sampson
269k76 gold badges546 silver badges570 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
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
Shoaib Ahmed
77113 silver badges28 bronze badges
Comments
Try this one:
<input type="submit" value="Enter" name="submit" style="background:url('/imgBG.jpg') no-repeat;width:100;height:50;border:none;"/>
<input type="image" name="submitbtn" src="images/submit.gif">