-1

I am using the jquery-steps plugin and would like to call the steps initialization method on another form but with the same settings.

Is there a way to tell JavaScript to do this without having to call steps again with the same settings? I'm thinking of something analogous to the send method in Ruby if that helps.

Source code:

var formWizard = $('form#myform').children('div.page-1');
formWizard.steps({
    headerTag: "h3",
       bodyTag: "section"
    //other settings that make this steps method long
});

I want to use a send method like Ruby or some other way to avoid repeating the steps call with all the arguments:

var formWizard2 = $('form#myform').children('div.page-2');
var hash_args = {
    headerTag: "h3",
       bodyTag: "section"
    //other settings that make this steps method long
}
formWizard2.send(:steps, hash_args)
Nona
  • 5,302
  • 7
  • 41
  • 79
  • You don't use `send` in Ruby to pass arguments to a method or set up default arguments, you use `send` to call a method whose name isn't known until runtime. Your question doesn't make any sense as it is. – mu is too short Jul 30 '15 at 22:23
  • mu, you can use send to invoke another method by name: "send is a ruby (without rails) method allowing to invoke another method by name." http://stackoverflow.com/questions/3337285/what-does-send-do-in-ruby – Nona Jul 30 '15 at 22:37

1 Answers1

1

I might be misunderstanding your question... but why don't you just save the config to a variable and use it:

var config = {
        headerTag: "h3",
        bodyTag: "section"
        //other settings that make this steps method long
}

formWizard.steps(config);
var formWizard2 = $('form#myform').children('div.page-2');
formWizard2.send(config)
dave
  • 62,300
  • 5
  • 72
  • 93