Call jQuery defined function via string

后端 未结 2 990
自闭症患者
自闭症患者 2021-01-05 00:43

I\'d like to call functions I\'ve defined within the document ready function of jQuery, but am having a bit of trouble. I have the following code:

jQuery(doc         


        
2条回答
  •  孤城傲影
    2021-01-05 01:36

    The best way, if not Eval, would be to use setTimeout with zero milliseconds, as you can specify the function as a string.

    setTimeout('myfunction()',0,);
    

提交回复
热议问题