Question:
(题:)
If I link in two JavaScript files, both with $(document).ready
functions, what happens?
(如果我链接两个JavaScript文件,都带有$(document).ready
函数,会发生什么?)
Does one overwrite the other?(有人会覆盖另一个吗?)
Or do both $(document).ready
get called?(或者两个$(document).ready
被调用?)
For example,
(例如,)
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript" src="http://.../jquery1.js"></script>
<script type="text/javascript" src="http://.../jquery2.js"></script>
jquery1.js :
(jquery1.js:)
$(document).ready(function(){
$("#page-title").html("Document-ready was called!");
});
jquery2.js:
(jquery2.js:)
$(document).ready(function(){
$("#page-subtitle").html("Document-ready was called!");
});
I'm sure it is best practice to simply combine both calls into a single $(document).ready
but it's not quite possible in my situation.
(我确信最好将两个调用组合成一个$(document).ready
但是在我的情况下它不太可能。)
ask by rlb.usa translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…