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 ());
});