onFocus
, onBlur
, and onChange
events are often used in combination with validation of form fields.
Below is an example of how to use the onChange
event, which executes JavaScript code when a change event occurs; that is, when a select
, text
, or textarea
field loses focus and its value has been modified.
lowerCase()
function will be called whenever the user changes the content of the field.
The function converts the uppercase letters in the Unix shell command to lowercase letters before the command is executed:
this
refers to the current object.
In general, in a method this
refers to the calling object.
getElementById()
of the object document
returns the element with the specified ID.
toLowerCase()
of the object string
returns the calling string value converted to lowercase.
|
“What’s the difference between a refrigerator and an elephant?” “What?” “Are you stupid? Like, everything.” — Nikki Glaser |