Home >Web Front-end >JS Tutorial >jquery dialog keyboard event code_jquery

jquery dialog keyboard event code_jquery

WBOY
WBOYOriginal
2016-05-16 18:22:13940browse

Add the following code segment in the open event of dilog

Copy the code The code is as follows:

$( "#dlgSearch").dialog({
autoOpen: false,
bgiframe: true,
width: 600,
//height: 225,
modal: true,
resizable : false,
open: function() {
//Keyboard event of jquery’s dialog (retrieve by pressing enter after inputting)
$(this).bind("keypress.ui-dialog", function( event) {
if (event.keyCode == $.ui.keyCode.ENTER) {
alert("enter pressed!");
}
});
},
buttons: {
"Cancel": function() {
$(this).dialog("close");
},
"Search": function() {
}
},
close: function() {
}
});

Statement:
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