我有这个简单的脚本:
$(document).ready(function() {
alert("HI");
)};
警报从来没有出现过。但是如果我删除 document.ready 部分,它将立即加载。有谁知道为什么?
我有这个简单的脚本:
$(document).ready(function() {
alert("HI");
)};
警报从来没有出现过。但是如果我删除 document.ready 部分,它将立即加载。有谁知道为什么?
你有一个错字。最后一行应该});
不是)};
。
Yes. Variables starting with $
signify (generally since other libraries could use $
sign too) jQuery objects. So its most likely your jQuery object is not loaded.
When you remove the $(document).ready ..)
it becomes just plain javascript and you get the alert("hi")
.
ALSO there is this typo in the last line )};
should be });
which only means your jQuery variable of $(document)
was not set properly.
最后一行应该是
})
代替
)}