How to check if a jquery plugin is installed or available

June 11, 2012Tagged: jquery

Most Jquery plugins act a lot like functions. They are attached to the main Jquery object, so essentially all we have to do is check that the function exists and is defined.

if ($.pluginFunction) {
  // Function exists, do your plugin stuff here.
} else {
  // Plugin does not exist, use alternatives or do nothing in here.
}

Profile picture

Written by Jelani Harris who lives and works in Wisconsin building useful things. You should follow them on Twitter