Sunday, February 12, 2012

make jQuery load one in joomla


I'm creating a module for joomla that needs jQuery and some jQuery plugins.





My problem is that if other plugins load jQuery too it rewrites mine and disables jQuery plugins!

How can I make sure jQuery loads only once (And before my plugins) in page?

thanks.

2 comments:

  1. dont load jquery each time, test first if it's already loaded

    <script type="text/javascript">
    if (typeof jQuery === 'undefined') {
    document.write(unescape("%3Cscript src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
    }
    </script>

    ReplyDelete
  2. The information provided here will probably solve your issues:

    Load JQuery only once

    ReplyDelete