HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Help with adding jQuery

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#61023 (In Topic #13269)
Avatar

Fan in training

Hey everyone, I'm looking to use jQuery on my site. My question is how can I link the jQuery library file to my site?

I've tried adding <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script> to the HEADER.tpl file, and even copy-pasting the entire source code into JAVASCRIPT_CUSTOM_GLOBALS.tpl, but it doesn't seem to be working. I know that my code isn't the problem because I've written and tested everything in Visual Studio and it works fine.

I used the manual installer, so is there a folder I need to place the source file in?
Back to the top
 
Posted
Rating:
#61024
Avatar

Community saint

Have you tried calling the latest version?

Code

    <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' type='text/javascript'/>

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#61031
Avatar

The most obvious thing to check first is if the HTML you put into the header template actually appears in the output.

If it doesn't work I would guess you're plugging it into a file that has been overridden and the override is still taking precedence.

It's better just to use the template editor until you're familiar with how themes and overrides work.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#61049
Avatar

Fan in training

Everything I put into the header template is showing up just fine, including the latest version of the jQuery library (thanks for the link!), but my code is still not working.

I placed my custom jQuery code inside JAVASCRIPT.tpl but it isn't working.  I know the file isn't the problem becuase I have other JS functions in that file that are working.
Back to the top
 
Posted
Rating:
#61054
Avatar

Next I'd get used to debugging in Firebug or whatever equivalent your browser might have. I know Firebug best and it has a few useful things. Open the console before clicking refresh and see if any JS errors come up. Check the 'net' tab to see if there are any errors like 404 errors against the Javascript file and that it does load. Run test commands from the console.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: