Thursday, 17 October 2013

Check if jquery plugin is loaded

We might always want jquery plugin which would be used in specific page instead of getting loaded in all pages.  We call that jquery plugin file in that page only and also define the function in particular html page only. But writing this code in particular page is not a good practice instead it should be in written in main javascript file which contains all the jquery functions.

 If we write that function in main javascript file then we end with getting error as that plugin file is been defined in that particluar page only.

 How to check if jquery plugin is loaded or not ?

 Checking if method exist

   if($.fn.pluginname != 'undefined'){}



  Replace pluginname with whatever you are calling.


       heightStyle: "content"


  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai