buttons to submit a form

After attending an HTML class, your first excise to submit an html form must be using a <input type=”submit”> button. Clicking the button will submit the values in the form to the server. If you addict to the “input” element of “submit” type for submitting a form, you must be confused about the following code:

<input type="image" src="/button.png">

This is an image button. If you click on it, you’ll see the form is submitted. How could this happen? In fact, there are quite a few ways to submit html forms including using an “input” element of “image” type. If you do not know it, you must be finding the js code that binds the click event handler to the image button. Until you can not find the click event handing function will you realize that the image input itself is enough to submit the form. Other elements that can submit a form include a button element(without a type attribute). Note that the following buttons will not trigger the submission of a form:

<input type="button">
<button type="button">clickme</button>

 

Comments are closed, but trackbacks and pingbacks are open.