Jquery_ Event Basics

Source: Internet
Author: User

JavaScript has a very important function, which is event-driven. When the page is fully loaded, the user triggers the element of the bound event in the page by the mouse or keyboard. JQuery is a great way for developers to write event behavior more efficiently, encapsulating a number of useful event methods for our use.

One, event binding

JQuery uses the. bind () method to bind these events to an element. Three parameters can be passed: Bind (type, [data], FN), type represents one or more types of event name strings, [data] is optional and is passed as an additional data as the Event.data property value , which is a string, a number, An array or an object; FN represents a handler that is bound to a defined element.

<Scripttype= "Text/javascript"src= "Http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></Script><Scripttype= "Text/javascript">    $(function(){        //Use Click events        /*$ (' input '). Bind (' click ', function () {Alert ("click");        }); */                //General processing Functions        /*$ (' input '). Bind (' click ', FN);        function fn () {alert ("click"); }        */    });</Script></Head><Body>    <inputtype= "button"value= "click" /></Body>

Multiple events can be bound at the same time

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.