Categories
Development jQuery

How to code Jquery to work on multiple, instances of the code?

I am trying to right a Jquery which I want to run for all the plugin.
This code has a lot of code calling other functions starting with init function.

How can I make it work for mutiple instance?

For example:

jQuery(document).ready(function($){

   var formButtonSelector = 'lead-form';

   function init() {
       buildForm();
   }

   funciton buildForm(){
       $(formSelector).parents('form');
   }

 });

Right now it only completely works on the first form.

How can I refactor in to work on every form ?

Leave a Reply

Your email address will not be published. Required fields are marked *