你好!以下是您需要翻译的内容:
在加载body中的js文件后,$(document).ready()会被调用吗?
如果我把$(document).ready()放在head标签中的script元素里,并让它带有一个回调函数,该回调函数使用在body中加载的一个脚本元素中声明的函数,是否可行?例如:
<!DOCTYPE HTML>
<html>
<script src="jquery.js" type="text/javascript"></script>
<script>
$(function(){
hello();
})
</script>
<head>
</head>
<body>
<script src="http://somewhere/helloFuncDeclaration.js" type="text/javascript"></script>
</body>
</html>
这样做是否正确,并保证在调用hello()函数之前加载了helloFuncDeclaration.js文件?
$({ hello(); })
是语法错误。 - rab