简体   繁体   中英

jQuery function custom assambled callback

Something like:

var myFunction = 'hello';    
$(".someElement").click(application.controller. + myFunction);

or

var myFunction = application.controller + '.hello';    
$(".someElement").click(myFunction);

So it should open application.controller.hello();

Any ideas? Cuz aboves isn't working.

Simply use:

var myFunction = 'hello';    
$(".someElement").click(application.controller[myFunction])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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