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"