How to make a submit out of a <a href...>...</a> link? How to make a submit out of a <a href...>...</a> link? javascript javascript

How to make a submit out of a <a href...>...</a> link?


More generic approatch using JQuery library closest() and submit() buttons.Here you do not have to specify whitch form you want to submit, submits the form it is in.

<a href="#" onclick="$(this).closest('form').submit()">Submit Link</a>


<input type="image" name="your_image_name" src="your_image_url.png" />

This will send the your_image_name.x and your_image_name.y values as it submits the form, which are the x and y coordinates of the position the user clicked the image.


It looks like you're trying to use an image to submit a form... in that case use<input type="image" src="...">

If you really want to use an anchor then you have to use javascript:

<a href="#" onclick="document.forms['myFormName'].submit(); return false;">...</a>