JQuery event processing and jquery event processing

Source: Internet
Author: User

JQuery event processing and jquery event processing
Browser event model DOM level 0th event model

When an event on an element in the dom tree is triggered, the event model checks whether the element has created a specific event processor. If yes, the created event processor is called. Then, the event model checks the parent element of the target element to see if it has created a processor for this event type. If yes, call the created processor and check its parent element, parent element of the parent element, and so on until the top of the dom tree.

DOM level 2nd event model IE event model jQuery event model bind event processor with jQuery

Bind (eventType, data, handler); bind (eventMap)

You can add a suffix separated by dots to the event name to specify a namespace to operate event processors in batches.

You can bind multiple events to an element using a single bind () method.

$('.whatever').bind({    click:function(event){/* handle */},    mouseenter: function (event) {/* handle */ },    mouseleave: function (event) {/* handle */ }})

Binding specific events:

Blur change click dblclick error focus focusin focusout keydown keypress keyup load mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup ready resize scroll select submit unload

When you use these convenient methods, the event. data value is read-only. They have a listener function, indicating the event processor.

Focusin focusout

One (eventType, data, listener)

Delete event Processor

Unbind (eventType, listener); unbind (event)

Delete a specific event Processor

Delete all event processors in the namespace

$('*').unbind('.fred')
Event instance

JQuery. Event attributes and Methods independent of browsers

Name Description
AltKey  
CtrlKey  
CurrentTarget  
Data  
MetaKey  
PageX  
PageY  
RelatedTarget  
ScreenX  
ScreenY  
ShiftKey  
Result  
Target  
Timestamp  
Type  
Which  
PreventDefault ()  
StopPropagation ()  
StopImmediatePropagation ()  
IsPropagationStopped ()  
IsImmediatePropagationStopped ()  
Pre-managed event processor (deprecated) trigger event Processor

Trigger (eventType, data)

TriggerHandler (eventType, data)

Convenient Method for triggering

Blur () change () click () dblclick () error () focus () focusin () focusout () keydown () keypress () keyup () load () mousedown () mouseenter () mouseleave () mousemove () mouseout () mouseover () mouseup () resize () scroll () select () submit () unload ()

Other event-related methods make full use of (more) Event Filtering large data sets

 

Create an element by copying a template

 

Create subject tag

 

Add a new filter

 

Add a restricted control

 

Delete unnecessary filters and other tasks

 

There is always room for improvement

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.