jquery - How do I assign a real function into a javascript object to use as a callback? -


i've got javascript mess looks like:

note: not working code, trying illustrate problem...

$(function() {     $(foo).something( {  //something grid control        buttons: {             add: {                 onclick: function() { //build dialog box add stuff grid                     $('<div></div>')                     .html('...')                     .dialog({                         buttons: {                             done: { //finished button on dialog box                                 onclick: function() {                                     $(this).dialog('close');                                 }                             }                         }                     });                 }             }        }      } ); }); 

i'd replace of function(){...}s real functions, clean things bit , rid of indenting. how assign real function 1 of callbacks rather anonymous function?

function abc(){   return false; } var callback = {click : abc} 

you can use callback.click.call or callback.click.apply


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -