HTML submit button onclick code
An HTML button is created using the following HTML code: <input type='submit' name="submit" value="Post Form" /> Or using the button tag like this: <button type="submit" >Post the form</button> In both the cases, pressing the button will submit the parent form without the need for handling the onclick event separately. If you want to validate the form before submitting, the best event handler would be the onsubmit event of the form. Example: