更新时间:2023-02-23 19:30:52
window.onload
不是jQuery函数,而是DOM事件.
window.onload
isn't a jQuery function, it's a DOM event.
如果使用jQuery,检查页面是否已加载的***方法是处理 ready 事件,该事件可以在各种方式
If using jQuery the best way to check whether the page is loaded is to handle the ready event which can be done in various ways
最短
$(function() {
// DOM initialized
});
短
$.ready(function() {
// DOM initialized
});
更长
$(document).ready(function() {
// DOM initialized
});
最长
jQuery(document).ready(function() {
// DOM initialized
});