Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't get JQuery to work in Master Page
    primarykey
    data
    text
    <p>I have a sample jquery in a form with no master page, and it works fine. I am trying to use the same function inside my master page but it does not work, I am using ASP.NET. Here is my code for both:</p> <p>WebForm (This works):</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="Surfitlocal.WebForm3" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;script src="scripts/jquery-1.3.2.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $('#pHeader').click(function() { $('#pBody').slideToggle('slow'); }); }); &lt;/script&gt; &lt;style type="text/css"&gt; .cpHeader { color: white; background-color: #719DDB; font: bold 11px auto "Trebuchet MS", Verdana; font-size: 12px; cursor: pointer; width:450px; height:18px; padding: 4px; } .cpBody { background-color: #DCE4F9; font: normal 11px auto Verdana, Arial; border: 1px gray; width:450px; padding: 4px; padding-top: 7px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:Panel ID="pHeader" runat="server" CssClass="cpHeader"&gt; &lt;asp:Label ID="lblText" runat="server" /&gt; &lt;/asp:Panel&gt; &lt;asp:Panel ID="pBody" runat="server" CssClass="cpBody"&gt; Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur &lt;/asp:Panel&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>MasterPage (This does NOT work):</p> <pre><code>&lt;%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Biz.Master.cs" Inherits="Surfitlocal.Site1" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;script src="scripts/jquery-1.3.2.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $('#pHeader').click(function() { $('#pBody').slideToggle('slow'); }); }); &lt;/script&gt; &lt;style type="text/css"&gt; .cpHeader { color: white; background-color: #719DDB; font: bold 11px auto "Trebuchet MS", Verdana; font-size: 12px; cursor: pointer; width:450px; height:18px; padding: 4px; } .cpBody { background-color: #DCE4F9; font: normal 11px auto Verdana, Arial; border: 1px gray; width:450px; padding: 4px; padding-top: 7px; } &lt;/style&gt; &lt;asp:ContentPlaceHolder ID="head" runat="server"&gt;&lt;/asp:ContentPlaceHolder&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:Panel ID="pHeader" runat="server" CssClass="cpHeader"&gt; &lt;asp:Label ID="lblText" runat="server" /&gt; &lt;/asp:Panel&gt; &lt;asp:Panel ID="pBody" runat="server" CssClass="cpBody"&gt; Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur &lt;/asp:Panel&gt; &lt;asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"&gt; &lt;/asp:ContentPlaceHolder&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload