0

I've tried setting up a jQuery toggle menu without much success. I followed the exact instructions and code from this tutorial, but even this simple script is not working.

Regular JS (like an alert) seems to work fine. I have Views installed and it seems the views admin uses extensive jQuery and works fine. Is there something I have to do to enable jQuery on my theme?

6
  • Did you clear cache?, e.g Admin > Config > Performance Commented Jan 4, 2013 at 6:32
  • Thanks David, yes I cleared it several times, and manually ran CRON then cleared it again, still no joy. I am running a custom theme, do I need to load/install jQuery on it or is it supposed to be available globally? Commented Jan 4, 2013 at 7:43
  • 1
    jQuery is added by Drupal core and is available globally. Check your script.js has been added to the html source. Commented Jan 4, 2013 at 8:03
  • Ah, glad it's sorted! re: comment upvoting, there's a little triangle that shows on comment hover. All the best, DT Commented Jan 4, 2013 at 9:51
  • @David, I deleted my previous comment by mistake. Your answer worked, I included the following preprocess in my module: code function myTheme_preprocess_page(&$vars) { drupal_add_js(path_to_theme().'/scripts/myTheme.js','file'); } ps not sure why but hover upvote doens't come on for me perhaps I don't have enough reputation. Commented Jan 6, 2013 at 5:47

1 Answer 1

2

jQuery is added by Drupal core and is available globally.

Clear cache at Admin > Config > Performance

Check your script.js has been added to the html source.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.