简体   繁体   English

jQuery函数-重新调用自调用函数

[英]jQuery functions - re-invoking a self invoking function

I have a function that is I think is self invoked and I'm trying to figure out how to call it again. 我有一个我认为是自我调用的函数,我试图弄清楚如何再次调用它。

This is how the function is declared: 这是函数的声明方式:

 jQuery(function setupFormInputHandlers(){
     ...
 }

I try to put setupFormInputHandlers() in the developer tools console but I get an undefined error. 我尝试将setupFormInputHandlers()放在开发人员工具控制台中,但是出现未定义的错误。

See jQuery document ready 查看jQuery文档已准备就绪

// Passing a named function instead of an anonymous function.

function readyFn( jQuery ) {
    // Code to run when the document is ready.
}

$( document ).ready( readyFn );

//invoke again
readyFn()

$ is just used as alias to jQuery so when you say $('x') you mean jQuery('x')..the main function is overloaded to make it familiar and to allow working with ease... also what you are asking about the function (may be you missed pasting other part) $只是用作jQuery别名,因此当您说$('x')时,您的意思是jQuery('x').. main函数被重载以使其熟悉并允许轻松工作...询问功能(可能是您错过了粘贴其他部分)

$(function(){}); or
jQuery(function(){}); 

both are methods of calling anonymous function shorthand for 都是调用匿名函数速记的方法

$(document).ready(function()
{
   //your code
}
);` 

in simple words it means "When the document loading complete register your an anonymous function" 简单来说,它的意思是“当文档加载完成时,注册您的匿名函数”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM