0

Basically I am trying to pass an object to a function, the object has a named function as one of its parameters as follows:

callFunctionOne({
        buttons: [{
            label: 'label',
            action: function e(dialog) {
                dialog.setTitle('Title 1');
            }}]
})

function callFunctionOne(options){

  let buttons = options['buttons'];
  for (let t = 0; t < buttons.length; t++){
     let button = buttons[t];
     $(document).on('click','#'+'amazingID'+button['label'],function(g){
       // Trying to call the function on button click only
       button.action.e();
     });
  }
}

So, This is how I'm trying to write it but its obviously wrong because I get e is not defined as a function error.

What am I doing wrong here, how do I go about passing a function as a parameter and then defining that the function is only called when the button is clicked?

Any help would be appreciated. Thanks.

Minstrels
  • 53
  • 9

0 Answers0