$(function(){});

jQuery( callback )Returns: jQuery

Description: Binds a function to be executed when the DOM has finished loading.

This function behaves just like $( document ).ready(), in that it should be used to wrap other $() operations on your page that depend on the DOM being ready. While this function is, technically, chainable, there really isn"t much use for chaining against it.

Examples:

Example: Execute the function when the DOM is ready to be used.

1
2
3
$(function() {
// Document is ready
});

Example: Use both the shortcut for $(document).ready() and the argument to write failsafe jQuery code using the $ alias, without relying on the global alias.

1
2
3
jQuery(function( $ ) {
// Your code using failsafe $ alias here...
});
发布了430 篇原创文章 · 获赞 415 · 访问量 925万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览