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

How jquery captures events triggered by the Enter key_jquery

WBOY
Release: 2016-05-16 16:51:19
Original
1184 people have browsed it

1. jquery captures the Enter key:

Copy code The code is as follows:

$("html ").die().live("keydown",function(event){
if(event.keyCode==13){
//Add the logic to be processed here
}
} );

//Bind carriage return action
$('textarea[name=chattext]').keydown(function(event){
if(event.which==13){

}
});

2.jquery to get multiple selected checkbox values:
Copy code The code is as follows:

$('input[type="checkbox"][name="types"]:checked').each(function() {
types = types $(this).val() "|";
}
);

3.jquery asynchronous request method:
Copy code The code is as follows:

$.ajax({
url : "${pageContext.request.contextPath }/UOSRoleManangerAction.do?method=createRole",
type : "post",
dataType : "html",
data:{"roleName":roleName,"roleDescription":roleDescription,"roles" :roles,"types":types},
success : function(data){
var dataObj=eval("(" data ")");
if(dataObj.result){
alert("Operation successful!");
submitForm(null,"initPage");
}else {
alert("Operation failed!");
}
}
});
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