I see that in different plugins and codes, but I don't understand what does that function... In the jQuery api isn't referenced!

推荐答案

apply calls a function with a set of arguments. It's not part of jQuery, it's part of core Javascript. However, there is mention of it in the jQuery docs:

http://docs.jquery.com/Types#Context.2C_Call_and_Apply

Syntax:

somefunction.apply(thisObj, [argsArray])

The above calls the function somefunction, setting this to thisObj within the function's scope, and passing in the arguments from argsArray as the arguments to the function.

Jquery相关问答推荐

如何在html css中制作响应表

如何根据另一个 radio Select 并切换?

Jquery 表数据无法在 html 上正确显示

jQueryUI 模态对话框不显示关闭按钮 (x)

使用 jQuery 时何时/为什么要在变量前加上$?

在 JSON 对象上使用 jQuery 的 find()

未捕获的类型错误:无法读取未定义的属性toLowerCase

为什么 jquery fadeIn() 不能与 .html() 一起使用?

如何使用 JQuery 发布 JSON 数据?

如何立即启动 setInterval 循环?

试图检测浏览器关闭事件

如何使用jQuery在弹出窗口中预览输入类型=文件中的选定图像?

jQuery 不会从 AJAX 查询中解析我的 JSON

jQuery 如果 div 包含此文本,则替换该部分文本

jquery: $(window).scrollTop() 但没有 $(window).scrollBottom()

带有 jQ​​uery 的饼图

如何在新窗口中打开链接?

检测夹点的最简单方法

当 iframe 在 jQuery 中完成加载时,如何触发事件?

jQuery 将换行符转换为 br (nl2br 等效)