jQuery with Master/Contentpages

5 posts, 0 answers
  1. Thomas
    Thomas avatar
    42 posts
    Member since:
    Aug 2010

    Posted 12 Apr 2013 Link to this post

    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
  2. moegal
    moegal avatar
    278 posts
    Member since:
    Jul 2007

    Posted 14 Apr 2013 Link to this post

    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>
  3. Thomas
    Thomas avatar
    42 posts
    Member since:
    Aug 2010

    Posted 14 Apr 2013 Link to this post

    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?

     

  4. moegal
    moegal avatar
    278 posts
    Member since:
    Jul 2007

    Posted 14 Apr 2013 Link to this post

    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.
  5. Thomas
    Thomas avatar
    42 posts
    Member since:
    Aug 2010
Back to Top