About jquery input Textare event binding and usage learning _jquery

Source: Internet
Author: User
(1) JQuery binding Event
Currently over 1.7, jquery's event bindings have replaced the original bind with on;
Difference: (personal understanding) bind is a binding event to every child node; On is only bound to the parent node and then bubbles to each child 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, which means that the above usage applies to on;
In addition, on more than two optional parameters on bind
On (events [, selector] [, data], handler (EventObject))

Selector: To bind the element, the above example can be written as: $ (". Class"). Bind (' click ', ' Input ', function (e) {...; E.stoppropagation;})
(Note that there is an incident is not good to use, is ' stool ' ie under the unique event: Onpropertychange;
Can be used: $ (". class input"). Bind (' PropertyChange ', function (e) {...; E.stoppropagation;})
No response: $ (". Class"). Bind (' propertychange ', ' input ', function (e) {...; E.stoppropagation;})
)

Data: Parameter passed to Event.data, $ (". Class"). Bind (' click ', ' input ', ' 123 ', function (e) {alert (e.data/*123*/); E.stoppropagation;})
(More specific use to view the manual http://api.jquery.com/on/);

(2) Input Textare event
Before doing a text box content real-time Change event trigger, with OnKeyUp + onchange; But Onchang must not be triggered until the text box is burnt, and later found that it can be used
(if IE) Onpropertychange + else oninput to handle.

Description
Oninput events are triggered when user input, backspace, delete, cut, paste, and mouse cut and paste (may be slightly different in ie9&ie9+).
(Firefox, Chrome, ie9&ie9+ are supported)
Onpropertychange event triggers when user input, backspace, delete, cut, paste, and mouse cut and paste
(IE support only).

(3) Common events(http://www.jb51.net/article/25583.htm)
Oncut event is triggered when pasting (Ctrl + V), mouse pasting
OnActivate is triggered when an object is set to an active element.
Onafterupdate is triggered on a data-bound object when the associated object in the data source object is successfully updated.
The Onbeforeactivate object is triggered immediately before it is set to the current element.
Onbeforecut-Zhong District is fired from the source object before it is deleted from the document.
Onbeforedeactivate fires immediately before activeelement changes from the current object to other objects in the parent document.
Onbeforeeditfocus is triggered before an object contained within an editable element enters the user interface activation state or when an editable container becomes a control check area.
Onbeforepaste is triggered on the target object before pasting from the system Clipboard to the document in the selected area.
Onbeforeupdate is triggered on a data-bound object before the associated object in the data source object is successfully updated.
Onblur is triggered when an object loses input focus.
OnChange is triggered when the contents of an object or selection change.
OnClick triggers when the user clicks the object with the left mouse button.
OnContextMenu is triggered when a user opens a context menu using the right mouse button to click the client area.
Oncontrolselect is triggered when the user is about to make a control selection for the object.
Oncut is triggered on the source element when the object or selection is deleted from the document and added to the system Clipboard.
OnDblClick is triggered when the user double-clicks the object.
OnDeactivate is triggered when the activeelement changes from the current object to another object in the parent document.
Ondrag continues to fire on the source object when a drag operation is in progress.
Ondragend triggers on the source object when the user releases the mouse after the drag operation finishes.
OnDragEnter triggers on the target element when the user drags the object to a legitimate drag target.
OnDragLeave triggers on the target object when the user moves the mouse out of the legitimate drag target during the drag operation.
OnDragOver when a user drags an object across a legitimate drag target, it continues to trigger on the target element.
Ondragstart triggers on the source object when the user starts dragging the text selection or when the object is selected.
OnDrop triggers on the target object when the mouse button is released during the drag operation.
Onerrorupdate is triggered on a data-bound object when an error occurs updating the associated data in the data source object.
Onfilterchange is triggered when a visual filter changes state or completes a transformation.
Onfocus is triggered when the object gets focus.
Onfocusin is triggered before the element will be set to focus.
Onfocusout triggers immediately after the focus is moved to the other element, triggering on the element that currently has focus.
OnHelp is triggered when the user presses the F1 key when the browser is the current window.
OnKeyDown is triggered when the user presses the keyboard key.
OnKeyPress is triggered when the user presses a literal key.
OnKeyUp is triggered when the user releases the keyboard key.
Onlosecapture is triggered when the object loses mouse capture.
OnMouseDown is triggered when a user clicks an object with any mouse button.
Onmouseenter is triggered when the user moves the mouse pointer inside the object.
OnMouseLeave is triggered when the user moves the mouse pointer out of an object boundary.
OnMouseMove is triggered when the user moves the mouse over the object.
onMouseOut is triggered when the user moves the mouse pointer out of an object boundary.
onMouseOver is triggered when the user moves the mouse pointer inside the object.
OnMouseUp is triggered when the user releases the mouse button while the mouse is over the object.
OnMouseWheel is triggered when the mouse wheel button rotates.
OnMove triggers when an object is moved.
Onmoveend is triggered when the object stops moving.
Onmovestart is triggered when the object begins to move.
Onpaste triggers on the target object when the user pastes data to transfer data from the system Clipboard to the document.
Onpropertychange is triggered when a property change occurs on an object that occurs on the object.
onReadyStateChange is triggered when an object's state changes.
OnResize is triggered when the size of the object is about to change.
Onresizeend is triggered when the user changes the size of the object in the selection area of the control.
Onresizestart is triggered when the user starts to change the size of the object in the control's check area.
Onselect is triggered when the current selection changes.
The Onselectstart object will be triggered when it is about to be selected.
Ontimeerror is triggered unconditionally when a particular time error occurs, which is usually caused by setting the property to an invalid value

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.