我希望在关注输入时打开一个对话框。它曾经完美地工作,但我必须升级 jQuery 和/或 jQueryUI,现在 FF 不会删除模式,IE 甚至不会关闭对话框。请参阅http://jsbin.com/EdupOgE/2/以获取实时示例。如我的示例所示,使用单击确实可以正常工作,但不能使用焦点。为什么会发生这种情况,我该如何解决?谢谢
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<title>Testing</title>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/ui-lightness/jquery-ui.css" type="text/css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.js" type="text/javascript"></script>
<script type='text/javascript'>
$(document).ready( function() {
$("#id_focus").focus(function(){$("#dialog").dialog("open");});
$("#id_click").click(function(){$("#dialog").dialog("open");});
$("#dialog").dialog({
autoOpen : false,
modal : true,
buttons : [{text : 'CANCEL',click : function() {$(this).dialog("close");}}]
});
});</script>
</head>
<body>
None: <input type="text" value="" />
Click: <input id="id_click" readonly="readonly" value="PORTLAND OR 97232" />
Focus: <input id="id_focus" readonly="readonly" value="PORTLAND OR 97232" />
<div id="dialog" title="Title"></div>
</body>
</html>