Javascript Assign functions to a button

Useful snippet for SharePoint forms for binding various event handlers to the Submit button.

var handlerArray = Array[];
function RegisterButtonClickHandlers(handlerArray) 

   for (var x = 0; x < handlerArray.length; x++) 
     {
      var handler = handlerArray[x];
      submitButton.addEventListener("click", handler):

     }

}

Leave a Reply