Search code examples
javascriptjquerycallbackjeditable

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?


Solution

  • Is that what you're trying to do: http://jsfiddle.net/LekisS/yNLu6/7/ ?