Submit buttons in HTML

HTML Buttons: The event generators

HTML buttons HTML event generators. HTML buttons do not submit a form. We use HTML buttons mainly to generate “onclick” event. Most these purposes are accomplished by using JavaScript. So when you are submitting a form using AJAX, you are much likely to see a button in action.

You create an html button using the following code.

Code Output
<input type=button value="Submit">

The above code creates a button with text "Submit" written on it.


HTML Submit Button

This is other kind of button which submits a form to the location specified by action attribute of its parent form. Unless stopped by JavaScript, the submit button will always submit a form. If no action has been specified, the form is submitted to the same location.

The submit button is created just like any ordinary button.

Code Output
<input type=submit value="Submit">

This will create a button with label “Submit”.