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.
使用catch
块来捕获错误,或者首先使用if
以避免错误。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.