Jquery change and bind event code _jquery

Source: Internet
Author: User
The basic syntax for jquery:
Copy Code code as follows:

$ ("input[type= ' text ']"). Change (function () {
Here you can write the validation code you want;
});

2 When you bind a text box
Copy Code code as follows:

$ (function () {
$ ("#txtAssessmentTotal"). Change (function () {
Here you want to write the validation code;
})
})

Bind the event handler function for a specific event for each matching element.
The. Bind () method is the primary way to attach behavior to a document. All JavaScript event objects, such as focus, mouseover, and resize, can be passed in as type parameters.
A personal understanding of bind is to define an anonymous method for this event in order to achieve the validation you want;
jquery Basic Syntax:
Copy Code code as follows:

$ ("#txtAssessmentTotal"). Bind (' click ', function () {
Alert ($ ("#txtAssessmentTotal"). Val ());
});


More than 2 events: the name of the event is separated by a space;
Copy Code code as follows:

$ ("#txtAssessmentTotal"). Bind (' MouseEnter mouseleave ', function () {
Alert ($ ("#txtAssessmentTotal"). Val ());
});

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.