use jquery in contents(page/blog) or html widget

Topics: General
Dec 6, 2013 at 1:14 AM
I saw several posts related to this issue, on
or in this disussion board. still don't know where to put scripts.

for users :
1 still use the default theme (not new theme)
2 just need to use jquery (e.g., tabs) in the contents or html widget.

where do I put the

<script language="javascript" type ="text/javascript"> </script> thanks,
Dec 6, 2013 at 8:50 AM
I added these to layout.cshtml

Script.Require("jQuery").AtHead(); //working
Script.Include("jquery.ui.tabs.js").AtHead();  //not working

in the page html:
<script type="text/javascript" language="javascript">// <![CDATA[
$(function() {
// ]]></script>

//not working..
Dec 6, 2013 at 11:51 AM
Rather than using
I think you want
Dec 6, 2013 at 2:27 PM
Script.Require("jQueryUI_Tabs").AtHead(); //works

then for the content:
use example from : //works...

the question:
if added in the layout.cshtml, it is really a waste if the page/content doesn't use jquery..
is there a better way?
I saw somebody asked the similar question, the solution seems to be complicated...
Dec 6, 2013 at 2:33 PM
If you only need tabs (or any other script) for a specific part template, content template, etc. you can add the Script.Require(...) calls to just that template. That way, they'll only be loaded on the content that actually makes use of them.