How to add and apply own javascript to some page

709 views
Skip to first unread message

Ketan Ghumatkar

unread,
May 23, 2013, 12:27:56 PM5/23/13
to canvas-l...@googlegroups.com
Hi All,

I want to know how javascript is implemented in canvas lms?

I have written my own js and I want to apply it to quizzes/take_quiz.html.erb.
I try to include it using <%= javascript_include_tag %> at the top of page. But, it does not recognize '$'. Basically, my javascript is applying before jquery apply on page.

Where should I put my js file? From where it maintain the sequence to load javascript? 
Overall, how it work? Can anyone tell in details?

Thanks in advance.

Christopher Bennell

unread,
May 24, 2013, 10:01:03 AM5/24/13
to canvas-l...@googlegroups.com
Hi Ketan, 
The most straightforward way to add custom Javascript to Canvas is to use the built-in custom JS tool. On the account settings page, there are some settings for custom JS and CSS. You can upload a JS file to the "public" folder of your Canvas install, and reference that file in the custom JS settings. This will include your script on every page. If you need to target specific pages, this approach might no be the best (although you might be able to use page-specific body classes to target certain pages).
Reply all
Reply to author
Forward
0 new messages