jquery dialog键盘事件

在dilog的open事件中 添加如下代码段:

                    $("#dlgSearch").dialog({
	                autoOpen: false,
	                bgiframe: true,
	                 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() {
	                }
	            });

原文地址:https://www.cnblogs.com/kinpauln/p/1788843.html