首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

JQuery每天函数:核心jQuery(callback)

2012-11-22 
JQuery每日函数:核心jQuery(callback)?Allows you to bind a function to be executed when the DOM docum

JQuery每日函数:核心jQuery(callback)

?

Allows you to bind a function to be executed when the DOM document 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 to be operated on. While this function is, technically, chainable - there really isn't much use for chaining against it.

You can have as many $(document).ready events on your page as you like.

See ready(Function) for details about the ready event.

返回值

jQuery

参数

callback (Function) : 当DOM加载完成后要执行的函数

示例

当DOM加载完成后,执行其中的函数。

jQuery 代码:

$(function(){
// Document is ready
});

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

jQuery 代码:

jQuery(function($) {
// Your code using failsafe $ alias here...
});

热点排行