In this article, we have submitted a form using JavaScript by clicking a link. In the body tag, created an HTML form and specify the id, method, and action of the form. In the form, specify an anchor tag with an event onclick. Create a function for JavaScript that will get executed when the link is clicked.
You can use href=”#top” or href=”#” to link to the top of the current page. To use the anchor tag as submit button, we need the help of JavaScript. To submit the form, we use JavaScript . submit() function.
Two ways. Either create a button and style it so it looks like a link with css, or create a link and use onclick="this.closest('form').submit();return false;"
.
You can't really do this without some form of scripting to the best of my knowledge.
<form id="my_form">
<!-- Your Form -->
<a href="javascript:{}" onclick="document.getElementById('my_form').submit(); return false;">submit</a>
</form>
Example from Here.
Just styling an input type="submit"
like this worked for me:
.link-button {
background: none;
border: none;
color: #1a0dab;
text-decoration: underline;
cursor: pointer;
}
<input type="submit" class="link-button" />
Tested in Chrome, IE 7-9, Firefox
You are using images to submit.. so you can simply use an type="image"
input "button":
<input type="image" src="yourimage.png" name="yourinputname" value="yourinputvalue" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With