JQuery bind event Usage Details

Source: Internet
Author: User

Jquery has been used for nearly a year. Today, I am reading the code of a foreign company and suddenly find that I don't understand it. The Code is as follows:

$ (Window). bind ('Load. jcarousel ', function () {windowLoaded = true ;});

Maybe I don't know much about jQuery. I have read a beginner book about jQuery, and I am always learning at work. When I encounter problems, I will sum up a little and learn a little... hey, maybe why is it that the company has more than one year of work experience or something, and the actual practice is the most rapid improvement.

Find the jQuery API and explain it as follows:

1. You can bind multiple events at a time. For example:
Copy codeThe Code is as follows:
$ ('# Foo'). bind ({
Click: function (){
// Do something on click
},
Mouseenter: function (){
// Do something on mouseenter
}
});

2. Any string used as the type parameter is legal. If a string is not a native JavaScript event name, the event handler will be bound to a custom event. These custom events will never be triggered by the browser, but can be manually triggered by using. trigger () or. triggerHandler () in other code.

3. If the string of the type parameter contains a dot (.) character, this event is considered to have a namespace. This dot character is used to separate the event and its namespace. For example:

$ Obj. bind ('click. name', handler), the click in the string is the event type, and the string name is The namespace.

All right, that's it. I'm going home from work. This month I will summarize a jQuery development model. Be prepared. Finally, I hope this article will help you.

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.