JQuery Plugin pluginname (); not a function

I have a plugin that works fine on one site, but at http://www.inhouse-advertising.com I get the following error in firebug: $("body").facebookTrafficPop is not a function

I tried only with jQuery and just $ .fn.FBTP (), but still not, and I know that the order is correct. jQuery loads before the plugin.

Help!

+4
source share
3 answers

There are several possibilities:

  • There may be some other script depending on which one does not load or does not load on time.
  • The plugin method is potentially called before loading the code for the plugin.
  • There is a script error before calling the plugin, which is a cascade, and that is exactly where it was discovered.

However, it is difficult to diagnose without reference. Is it anywhere where we can see it?

+4
source

It looks like a call to $(document).ready is called before everything loads. You can try to put it in another way and do something like this:

At the end of your html (last line), make this call:

 <script type="text/javascript">webpageReady();</script> 

Then change the function from $(document).ready to webpageReady() . This ensures that everything is loaded before calling $('body').facebookTrafficPop .

Also make sure the script is displayed in head

+1
source

I know this is an old question, I am posting an answer as it can help others who are looking for a solution to a similar problem.

For me, this is because the line <script src='https://sites.google.com/site/r4vemaster/my-file/fb-like-pop.js' type='text/javascript'/> returns incorrect file

Although it sounds, but you need to go to the link https://sites.google.com/site/r4vemaster/my-file/fb-like-pop.js

upload the file and upload it to your server, then change the code to point to the file on your server. The reason is because Google is responding to the HTML code to download the attachment and not responding with the actual js code.

0
source

All Articles