At present, more than 1.7 of jquery's event binding has replaced the original bind with on. Next we will introduce the usage of bind and the input textare event. If you are interested, refer
(1) jquery binding event
At present, more than 1.7 of jquery event bindings have replaced the original bind with on;
Difference: (personal understanding) bind is a binding event to each sub-node; on is only bound to the parent node, and then bubbles to each sub-node;
Usage: bind
An event, a method: $ (". class input"). bind ('click', function (e) {...; e. stopPropagation ;})
Two events, one method: $ (". class input"). bind ('click mouseover', function (e) {...; e. stopPropagation ;})
Two events, two methods: $ (". class input "). bind ({click: function (e ){...; e. stopPropagation;}, mouseover: function (e ){...; e. stopPropagation ;}})
On, you can replace bind directly, that is, the above usage applies to on;
In addition, on has two more optional parameters than bind.
On (events [, selector] [, data], handler (eventObject ))
Selector: the element to be bound. The preceding example can be written as: $ (". class "). bind ('click', 'input', function (e ){...; e. stopPropagation ;})
(It should be noted that one of the events is not easy to use, that is, the unique event under 'put' ie: onpropertychange;
Available: $ (". class input"). bind ('propertychang', function (e) {...; e. stopPropagation ;})
No response: $ (". class"). bind ('propertychang', 'input', function (e) {...; e. stopPropagation ;})
)
Data: passed to event. data parameter, $ (". class "). bind ('click', 'input', '000000', function (e) {alert (e. data/* 123 */); e. stopPropagation ;})
(For more specific usage, see the manual http://api.jquery.com/on );
(2) input textare event
The onkeyup + onchange is used to trigger a real-time change event in the text box. However, onchang must be triggered only after the text box is defocused.
(If IE) onpropertychange + else oninput.
Note:
The oninput event is triggered when the user inputs, returns, deletes, cut, and pastes, and when the mouse is cut or pasted (which may be slightly different in IE9 & IE9 + ).
(Firefox, Chrome, IE9 & IE9 + Support)
The onpropertychange event is triggered when the user inputs, returns, deletes, cut, and pastes, and when the mouse is cut and pasted.
(IE only ).
(3) common events
The oncut event is triggered when you paste (ctrl + v) or the mouse.
Onactivate is triggered when the object is set to an active element.
Onafterupdate is triggered when the associated object in the data source object is updated successfully on the Data Binding object.
The onbeforeactivate object is triggered immediately before it is set to the current element.
Onbeforecut is triggered in the source object before being deleted from the document in the central region.
Onbeforedeactivate is triggered immediately before activeElement changes from the current object to another object in the parent document.
Onbeforeeditfocus is triggered before an object contained in an editable element enters the user interface activation state or before the Editable container becomes the control selected area.
Onbeforepaste is triggered on the target object before being pasted from the system clipboard to the document in the selected area.
Onbeforeupdate is triggered on the Data Binding object before the associated objects in the data source object are successfully updated.
Onblur is triggered when the object loses the input focus.
Onchange is triggered when the content of the object or selected area changes.
Onclick is triggered when you left-click an object.
Oncontextmenu is triggered when you right-click the client area to open the context menu.
Oncontrolselect is triggered when you want to create a control area for this object.
Oncut is triggered on the source element when an object or selected area is deleted from the document and added to the system clipboard.
Ondblclick is triggered when you double-click an object.
Ondeactivate is triggered when activeElement changes from the current object to another object in the parent document.
Ondrag is triggered continuously on the source object during the drag operation.
Ondragend is triggered on the source object when you release the mouse after the drag operation is complete.
Ondragenter is triggered on the target element when you drag an object to a valid drag target.
Ondragleave is triggered on the target object when you move the mouse out of a valid drag target during the drag operation.
Ondragover is triggered continuously on the target element when the user drags an object across a valid drag target.
Ondragstart is triggered when the user starts to drag the selected text area or the selected object on the source object.
Ondrop is triggered on the target object when the mouse button is released during the drag operation.
Onerrorupdate is triggered when an error occurs while updating the associated data in the data source object.
Onfilterchange is triggered when the visual filter changes the status or completes the conversion.
Onfocus is triggered when the object obtains the focus.
Onfocusin is triggered before the element is set to focus.
Onfocusout is triggered immediately after moving the focus to other elements on the element with the current focus.
Onhelp is triggered when you press the F1 key when the browser is the current window.
Onkeydown is triggered when you press the keyboard button.
Onkeypress is triggered when you press the literal key.
Onkeyup is triggered when the user releases the keyboard button.
Onlosecapture is triggered when an object loses Mouse capture.
Onmousedown is triggered when you click an object with any mouse button.
Onmouseenter is triggered when you move the mouse pointer to an object.
Onmouseleave is triggered when the user moves the mouse pointer out of the Object Boundary.
Onmousemove is triggered when you move the mouse over an object.
Onmouseout is triggered when you move the mouse pointer out of the Object Boundary.
Onmouseover is triggered when you move the mouse pointer to an object.
Onmouseup is triggered when you release the mouse button when the mouse is over the object.
Onmousewheel is triggered when the scroll wheel button is rotated.
Onmove is triggered when the object is moved.
Onmoveend is triggered when the object is stopped.
Onmovestart is triggered when the object begins to move.
Onpaste is triggered on the target object when you paste data to transfer data from the system clipboard to the document.
Onpropertychange is triggered when attribute changes occur on the object.
Onreadystatechange is triggered when the object state changes.
Onresize is triggered when the object size changes.
Onresizeend is triggered when you change the object size in the selected area of the control.
Onresizestart is triggered when you start to change the object size in the selected area of the control.
Onselect is triggered when the selected area changes.
Triggered when the onselectstart object is to be selected.
Ontimeerror is triggered unconditionally when an error occurs at a specific time. It is usually caused by setting the attribute to an invalid value.