This is a migrated thread and some comments may be shown as answers.

jQuery with Master/Contentpages

4 Answers 86 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Veteran
Thomas asked on 12 Apr 2013, 05:42 PM
Hi,

can anyone please enlighten me how to use jQuery on Master/Contentpages.

I have my scriptmanager on the Masterpage:
    <asp :ScriptManager ID ="RadScriptManager1" runat ="server">
        <Scripts >
            <asp :ScriptReference Assembly ="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp :ScriptReference Assembly ="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp :ScriptReference Assembly ="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts >
    </asp :ScriptManager >

How can I use jQuery on the Content page now?
Can anyone give me an example please?

Thanks in adavance for your help

best regards, Thomas

4 Answers, 1 is accepted

Sort by
0
moegal
Top achievements
Rank 1
answered on 14 Apr 2013, 03:59 PM
this is rather vague.

Use it just like you would on any webpage.

<script>
$(document).ready(function(){
  $("p").click(function(){
    $(this).hide();
  });
});
</script>

and add this to your page.

<p>If you click on me, I will disappear.</p>
<p>Click me away!</p>
<p>Click me too!</p>
0
Thomas
Top achievements
Rank 1
Veteran
answered on 14 Apr 2013, 05:25 PM
Thanks for your answer.

My mistake, I placed the script in:

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

Looks like it has to be placed in a ContentPlaceHolder inside the Body.

Any idea how I can get IntelliSense to work on the content page?

 

0
moegal
Top achievements
Rank 1
answered on 14 Apr 2013, 05:50 PM
do you mean IntelliSense for jquery? I think if you get the jquery version from nuget,  it will have the version that includes IntelliSense.

Not sure though.
0
Thomas
Top achievements
Rank 1
Veteran
answered on 14 Apr 2013, 07:08 PM
Tags
General Discussions
Asked by
Thomas
Top achievements
Rank 1
Veteran
Answers by
moegal
Top achievements
Rank 1
Thomas
Top achievements
Rank 1
Veteran
Share this question
or