好吧,我难住了。我有 jquery 工作的页面,但由于某种原因,这没有。
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
</body>
<script>
jQuery(function($) { alert() })(jQuery);
</script>
</html>
我怀疑这是我用于 jquery 的链接,但准备好的功能没有触发,我看不出原因。
好吧,我难住了。我有 jquery 工作的页面,但由于某种原因,这没有。
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
</body>
<script>
jQuery(function($) { alert() })(jQuery);
</script>
</html>
我怀疑这是我用于 jquery 的链接,但准备好的功能没有触发,我看不出原因。
试试这个方法
<script>
$(document).ready(function(){
alert('foo')
});
//OR
$(function() {
alert('foo');
});
</script>
它的 :
jQuery(document).ready(function()
{
alert('alert');
});
$( function() { alert("blah!!"); });
或者
jQuery( function() { alert("blah!"); });
或者
$(document).ready( function() { });
或者
$(window).load( function() { });
或者
jQuery(window).load( function() { });
或者
jQuery(document).ready( function() { });
数以千计的选择为您服务!
试试这个吧!
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
</body>
<script type="text/javascript">
$(function () {
alert("test");
});
</script>
</html>