Home > Web Front-end > JS Tutorial > body text

Jquery Change and bind event code_jquery

WBOY
Release: 2016-05-16 18:01:34
Original
1098 people have browsed it

The basic syntax of Jquery:

Copy code The code is as follows:

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

2 When binding a text box When
Copy code The code is as follows:

$(function () {
$ ("#txtAssessmentTotal").change(function () {
//Write the verification code you want here;
})
})

for each Bind an event handler to a specific event of the 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 the type parameter.
My personal understanding of bind is to bind an event to this control and define an anonymous method for this event to achieve the verification you want;
Jquery basic syntax:
Copy code The code is as follows:

$("#txtAssessmentTotal").bind('click', function() {
alert($( "#txtAssessmentTotal").val());
});


2 Multiple events: The names of the events are separated by spaces;
Copy code The code is as follows:

$("#txtAssessmentTotal").bind('mouseenter mouseleave', function() {
alert($("#txtAssessmentTotal").val());
});
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template