以下代码在Firefox,Chrome和Opera中生成预期的jQueryUI模式弹出对话框.但是,它在Internet Explorer 9中失败:
<html><head> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" type="text/css" media="all" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script> <script type="text/javascript"> $(function() { $( "#AddUser" ).dialog({ autoOpen: false,modal: true,height: 'auto',width: 400,buttons: { "Add": function() { alert("Add one!"); } },close: function() { allFields.val( "" ).removeClass( "ui-state-error" ); } }); $( "#AddUserButton" ).button().click(function(event) { event.preventDefault(); $( "#AddUser" ).dialog( "open" ); }); }); </script> </head><body> <div id="AddUser" title="Add User">Popup content here</div> <input type="submit" id="AddUserButton" /> </body></html>
在IE 9中,#AddUser div不是jQueryUI对话框.有什么我想念的吗?
谢谢.
解决方法
你的问题是尾随“,”IE不喜欢它
$( "#AddUser" ).dialog({ autoOpen: false,modal: true >>,<< });
这将工作:
$( "#AddUser" ).dialog({ autoOpen: false,modal: true });