jQuery中的function()是什么意思? [英] What does function() in jQuery mean?

查看:207
本文介绍了jQuery中的function()是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jquery中的function()是什么意思?因为几乎所有的jquery函数都具有function().

What does function() in jquery mean? Because almost all of jquery function has a function() in it.

例如:

$(function(){
     //Do Stuff here
});

或:

$.each(element, function(something, something){
     //Do Stuff here
});

我对jquery还是很陌生,感谢您的帮助.谢谢! :)

Im quite new to jquery, any help is appreciated. Thank you! :)

推荐答案

当jQuery需要回调function时使用.在这种情况下,其为匿名function.

It's used when jQuery expects a callback function. In this case, its an anonymous function.

function可以传递也可以不传递参数.

The function may or may not be passed arguments.

命名函数:

function name(){

}

函数表达式:

var name = function(){}

IIFE:

(function(){})();

可以将

function引用作为参数传递给您正在执行的另一个function.

function reference can be passed as an argument to another function which is what you are doing.

这篇关于jQuery中的function()是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆