I have several functions that are used to bind events with divs on the page. There’s MenuHandlers, CalendarHandlers, PopupHandlers….
So for the moment, I have a single function that’s called BindHandlers that I call from the document ready function and that runs all the handler functions one by one.
Is there a one-liner solution that would say something like “call all the functions that have “Handlers” in their function name?
Here’s what the function looks like:
function BindHandlers() {
MenuHandlers();
CalendarHandlers();
PopupHandlers();
... 8 more like this
}
What I’m looking to replace:
BindHandlers(); // replace that line with the following:
"call all the functions that have "Handlers" in their names
Thanks for the suggestions.
If these functions are all global, you could call all functions with
Handlersin the name with something like thisHere’s a simple demo