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, biapar, Willr, Ingo, swaiba, simon_w

[Solved] Straight up, can't get Jquery working


Reply


3 Posts   2704 Views

Avatar
jdi

Community Member, 34 Posts

23 February 2010 at 12:43pm

Edited: 23/02/2010 2:14pm

Hey Guys,

I'm trying to do things the most authodox way possible. So naturally I'm attempting to call the jquery data from the silverstripe library by following the Jquery documentation:
http://doc.silverstripe.org/doku.php?id=jquery

However... it's not really doing anything? Does anyone know any simple jquery scripts that I can use to check that it's working? Otherwise, any common issues with getting jquery to work in silverstripe that you know of?

Jackson

Avatar
jdi

Community Member, 34 Posts

23 February 2010 at 2:14pm

Test script:

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

      })
})(jQuery);

Avatar
banal

Community Member, 901 Posts

23 February 2010 at 7:36pm

Edited: 23/02/2010 7:50pm

You can skip the if statement. This should work:

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

If not, there might be a problem with the inclusion of jquery? Mabye multiple versions are being included?
Check your source-code.

Edit: Sorry, didn't realize you put a Solved in the title. I thought the script didn't work for you.