我的jquery脚本引用是:
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js" type="text/javascript"></script>
我使用的是Chrome版本23.0.1271.64 m-我在338 线上收到一个错误
})( jQuery ); //--> line 338 is highlighted
这对我来说是第一次,正在寻找答案。
我正在学习如何使用API,并有一个简单的网页
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />
<meta http-equiv="PRAGMA" content="NO-CACHE" />
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$( "#edit-user" )
.button()
.click(function() {
$( "#dialog-form" ).dialog( "open" );
});
});
</script>
</head>
<body>
<button id="edit-user">Edit User</button>
<div id="dialog-form" title="Radio Dialog">
<form>
<fieldset>
<input type='radio' value='A' name='myRadio'>A
<input type='radio' value='B' name='myRadio'>B
<input type='radio' value='C' name='myRadio'>C
</fieldset>
</form>
</div>
</body>
</html>
根据您提供的有限信息,我认为您希望打开某种对话框,对吧?
不管怎样,您的对话框实际上已经存在了,但是,为了查看正在发生的事情,请从隐藏它开始(但当您稍后真正实现它时,请使用.css):
<div id="dialog-form" title="Radio Dialog" style='display:none;'>
然后你似乎需要在打开对话框之前创建它。这很可能是阻止你前进的原因:
$(function() {
$( "#dialog-form" ).dialog({
autoOpen: false
});
$( "#edit-user" ).click(function() {
$( "#dialog-form" ).dialog( "open" );
});
});
看看这个jsfiddle
希望这能帮助你解决你遇到的任何问题!
您需要首先包含jquery