Contents:
.on( "change" [, eventData ], handler )Returns: jQuery
Description: Bind an event handler to the "change" event.
-
version added: 1.7.on( "change" [, eventData ], handler )
change
event. For the deprecated .change()
method, see .change()
.
change
event is sent to an element when its value changes. This event is limited to <input>
elements, <textarea>
boxes and <select>
elements. For select boxes, checkboxes, and radio buttons, the event is fired immediately when the user makes a selection with the mouse, but for the other element types the event is deferred until the element loses focus.
1
2
3
4
5
6
7
8
9
10
|
|
1
2
3
|
|
.trigger( "change" )
:
1
2
3
|
|
change
event on both of the form elements.
change
event bubbles in Internet Explorer, behaving consistently with the event in other modern browsers.
.val()
for example, won't fire the event.
Examples:
Example 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
|
Demo:
Example 2
1
2
3
|
|
.trigger( "change" )Returns: jQuery
Description: Trigger the "change" event on an element.
-
version added: 1.0.trigger( "change" )
-
"change"Type: stringThe string
"change"
.
-
.on( "change", ... )
.