Java Reference
In-Depth Information
Buttons
We've already used a button to submit a form, but there are different types of button. The
default type is submit , which is why we didn't have to specify the type in our search ex-
ample earlier. Another type is reset , which will reset all the form fields to their initial
settings. Let's add a reset button to our example by adding the following line to hero.htm,
just before the submit button:
<button type="reset">Reset</button>
Now have a go at filling in part of the form and pressing the reset button; all the form fields
should clear. Remember: this is not recommended good practice for usability reasons!
The other type is simply button . This doesn't need to be inside a form element and has
no default behavior. It simply creates a clickable button that can have an event listener at-
tached to it:
<button type="button">Click Me</button>
Search WWH ::




Custom Search