首页 > 编程 > JavaScript > 正文

jquery dialog键盘事件代码

2019-11-21 00:19:29
字体:
来源:转载
供稿:网友
在dilog的open事件中 添加如下代码段
复制代码 代码如下:

$("#dlgSearch").dialog({
autoOpen: false,
bgiframe: true,
width: 600,
//height: 225,
modal: true,
resizable: false,
open: function() {
//jquery之dialog的键盘事件(输入完毕回车检索)
$(this).bind("keypress.ui-dialog", function(event) {
if (event.keyCode == $.ui.keyCode.ENTER) {
alert("enter pressed!");
}
});
},
buttons: {
"取消": function() {
$(this).dialog("close");
},
"搜索": function() {
}
},
close: function() {
}
});

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表