简体   繁体   中英

Javascript scope and anonymous functions: How can I pass a parameter object to jQuery jEditable plugin?

[EDIT: Simplified question and code example I hope!]

Hi. I need a bit of help with JS scope and anonymous functions.

I want to put a generic 'set up' function wrapper around the jQuery 'jEditable' plugin (http://www.appelsiini.net/projects/jeditable) so that I can pass in the jEditable parameters I want and change the behaviour of the plugin, rather than keep repeating the jEditable code, with just a couple of changes to the parameters each time.

See http://jsfiddle.net/gcm5r/ for my code example.

I simply don't know how to pass a parameter object 'mySettings' through the wrapper function and have jEditable pick up those parameters in the callback I have created.

I'm sure this is a question to do with scope and constructing the call back correctly.

Can anyone help?

这就是您要执行的操作: http : //jsfiddle.net/LekisS/yNLu6/7/吗?

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