Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

JQuery does not load

Go to End

4 Posts   3642 Views


Community Member, 7 Posts

3 May 2010 at 8:10am


I'm trying to load a custom jQuery script from one of my templates. Heres my code.


(function($) {
	$(document).ready(function() {
      alert('jQuery is loaded!'); 

In the ss-file I have:
<% require javascript(mysite/javascript/Company.js) %>

The script is loaded, but it does not execute the alert. Do i need to include the jQuery library or something? I diden't find anything in the docs (

I'm using SS 2.4 rc2.

Thanks a lot


Community Member, 135 Posts

3 May 2010 at 1:16pm

Edited: 03/05/2010 1:16pm

Yes you need to include jquery. Load it before Company.js

<% require javascript(mysite/javascript/jquery-1.4.2.min.js) %>
<% require javascript(mysite/javascript/Company.js) %>

Make sure you download jquery and put it in your mysite/javascript folder:


Community Member, 7 Posts

3 May 2010 at 10:06pm

Thank you for your answer ampedup.

My thought was, that because of the fact, that jQuery is now the offical JS libary in the 2.4 release, I don't have to extra download and include jquery. Is there no possibility to use the SS jquery library?


Community Member, 135 Posts

4 May 2010 at 11:54am

Edited: 04/05/2010 11:55am

You could, but you would still need to call require javascript([jquerylocation]) to include it.

I personally prefer to download jquery and include that, or include the google api jquery:

But that's me, I don't know what the consensus of the community is.