onchange Attributeonchange Attributeonchange is declared on the elements: input type="text", input type="password", input type="file", input type="checkbox", input type="radio", textarea, selectThe onchange attribute specifies script to be executed
when the form control on which
it is specified changes its value. This happens, for example, when the text within a text
entry field is altered (it is triggered when the field loses focus after the change),
when a checkbox is toggled, when a radio button changes from "off" to "on" or when a different select
list option is chosen.
If you use this attribute (or any attributes of Type Script) the MIME type of the scripting language used should always be provided in a Content-Script-Type HTTP header.
It is good practice not to use these attributes, however,
and instead to include external scripts (via
script elements)
which add any handlers unobtrusively. This makes code more self-contained and
also the XHTML is easier to maintain if it doesn't contain any events attributes.