JQuery prevents multiple click double-click submissions and transmits Dynamic Function Methods

Source: Internet
Author: User

Today, I wrote a question about the double-click event of JQ to prevent multiple submissions. In addition, the function can be defined in batches to improve the accessibility and dynamically bind element events through methods. In addition, the function name or multiple parameters can be dynamically transferred (only the function name can be called through Eval in this instance ).

We all know that in jQuery event binding, the double-click event (dblclick) is triggered twice ). It is a Tag Element (such as div). If the element is bound with a click event or a double-click event (dblclick, the double-click event (dblclick) is not triggered. When the double-click event (dblclick) is executed, two click events are triggered ).

Let's take a look at the execution sequence of click events:

Click: mousedown, mouseout, click;
Double-click: mousedown, mouseout, click, mousedown, mouseout, click, dblclick;

In the double-click event (dblclick), the first click event will be blocked for the second time. That is to say, Double click Event (dblclick) returns the result of one click event and one double click event (dblclick. Instead of double-clicking the event result and clicking the event result ).

In this case, you only need to delete the redundant click Event (click), and this problem is solved.

The effect is as follows:

The source code is as follows:

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

  

(End)

Related Article

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.