There are some elements that are commonly paired up with event handlers in use. They will be featured in this page as we go.
<input>
<button>
<select>
<input type="the-type"
value="the-label"
onevent="the-action">
Attributes:
type
button
, submit
, and more.value
onevent
"alert('Greetings!')"
"functionName()"
-- with function detailed in <script>
HTML attributes are not case-sensitive, but usually lowercases are used. DOM Property is case-sensitive.
<select id="idName">
<option value="1">option1</option>
<option value="2">option2</option>
<option value="3">option3</option>
</select>
<select>
elements allow to select 1 option at a time.
<select id="idName" multiple>
<option value="1">option1</option>
<option value="2">option2</option>
<option value="3">option3</option>
</select>
Attribute multiple
allows multiple selection.
//code
References: