Interview Preparation JavaScript ES6+ Subjective
May 10, 2013

How can we submit from without a submit button?

Detailed Explanation

We can use a simple JavaScript code linked to an event trigger of any form field. In the JavaScript code, we can call the document.form.submit() function to submit the form.
<script type="text/javascript">
function submitform()
{
    document.forms["myform"].submit();
}
</script>
<form id="myform" action="submit-form.php">
Search: <input type='text' name='query'>
<a href="javascript: submitform()">Submit</a>
</form>

Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback