gpt4 book ai didi

jquery - $ 未定义

转载 作者:行者123 更新时间:2023-12-01 06:13:14 28 4
gpt4 key购买 nike

当我在 $(document).ready 之前明确包含 jQuery 库时,我无法弄清楚为什么它仍然无法识别 jQuery 语法

<!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 id="Head1"><title>

</title></head>
<body>

<form name="form1" method="post" action="jQueryDialogTest.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE2MTY2ODcyMjlkZA==" />

</div>


<script src="content/js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="content/js/popup.js" type="text/javascript"></script>
<div id="testDialog" winWidth="400" winHeight="500" winResizable="true">
Some test mark-up, should show inside the dialog
</div>
<div><input type="button" id="invokeDialog" value="Click Me!" /></div>
</form>

<script type="text/javascript">

$(document).ready(function()
{
$("input.invokeDialog").click.showDialog("#testDialog");
});

</script>

</body>
</html>

在 popup.js 中,我有这样的例子:

function showDialog(divID)
{
// Get reference to the div element
var dialogDiv = $(divID);

dialogDiv.dialog
(
{
bgiframe: true,
modal: true,
autoOpen: false,
show: 'blind'
}
)

dialogDiv.dialog("open");
}

最佳答案

您确定它实际上正在加载 JavaScript 文件吗? “Fiddler”等工具可以帮助您确定这一点。

此外,您的代码未正确终止,这可能会导致奇怪的错误。试试这个:

$(document).ready(function() 
{
$("input.invokeDialog").click.showDialog("#testDialog");
}
);

关于jquery - $ 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2631291/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com