I got an image with which links to another page using <a href="..."> <img ...> </a>
.
How can I make it make a post like if it was a button <input type="submit"...>
?
I got an image with which links to another page using <a href="..."> <img ...> </a>
.
How can I make it make a post like if it was a button <input type="submit"...>
?
Something like this page ?
We replace the submit button with this all the time on forms:
Clicking the image submits the form. Hope that helps!
This will send the
your_image_name.x
andyour_image_name.y
values as it submits the form, which are the x and y coordinates of the position the user clicked the image.What might be a handy addition to this is the possibility to change the post-url from the extra button so you can post to different urls with different buttons. This can be achieved by setting the form 'action' property. Here's the code for that when using jQuery:
The action-attribute has some issues with older jQuery versions, but on the latest you'll be good to go.