I’m having an issue with jQuery functions not running if a preceding function failed for example:
jQuery(function($) {
// this function failed to run because the dependency file wasn't loaded
});
jQuery(function($) {
// fails to run unless all preceding function succeed
});
jQuery(function($) {
// fails to run unless all preceding function succeed
});
I’m doing this because they’re all small chunks of code, each one for a jquery plugin used on my site so one for a slider another one for a drop down menu …, for example if a page without a slider I’m not loading the slider plugin so all everything after the slider function fails to run.
so what should I do so jquery ignores failing function ?
and thanks in advance.
Use a
catchblock to catch the error, or useifs to avoid it in the first place.