I like to display a custom message to user when jquery plugin required is not loaded on page.
For example to use jshowoff plugin (http://ekallevig.com/jshowoff/) its mandatory to include jquery.jshowoff.min.js However I would like to put some code to initially check if jquery.jshowff.min.js is already loaded on the page or not. And if not loaded, display error message saying that required plugin is not available rather than error is browser console as $.jshowoff is not a function.
Could someone advice on how to implement this please ?
Thank you very much for your help.
If you use the plugin via a jQuery object, e.g.:
...then you can test whether it's loaded like this:
If you use it directly from
jQuery
($
), e.g:...then you can test for that like this: