Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery $( returning null
    text
    copied!<p>I am having problems with my JQuery returning null.</p> <p>Here is my JQuery (which is contained in a .js)....</p> <pre><code>$(document).ready(function() { var chkBox = $("#gvEntryPoints input[id$='cbxIncludeAll']"); chkBox.click(function() { $("#gvEntryPoints input[type='checkbox']").attr('checked', chkBox.is(':checked')); }); // To deselect CheckAll when a GridView CheckBox is unchecked $("#gvEntryPoints INPUT[type='checkbox']").click(function(e) { if (!$(this)[0].checked) { chkBox.attr("checked", false); } }); </code></pre> <p>}</p> <p>It appears the chkBox never gets assigned and therefore there is never a click event that is assigned.</p> <p>Here is my HTML...</p> <pre><code>&lt;asp:GridView CssClass="GridView" ID="gvEntryPoints" runat="server" AutoGenerateColumns="false"&gt; &lt;Columns&gt; &lt;asp:TemplateField Visible="false"&gt; &lt;ItemStyle CssClass="GridView_Item" /&gt; &lt;ItemTemplate&gt; &lt;asp:Label runat="server" ID="lblEntryPointListItemId" Text='&lt;%# Eval("EntryPointListItemId") %&gt;'/&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:TemplateField Visible="false"&gt; &lt;ItemStyle CssClass="GridView_Item" /&gt; &lt;ItemTemplate&gt; &lt;asp:Label runat="server" ID="lblEntryPointId" Text='&lt;%# Eval("EntryPointId") %&gt;'/&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:TemplateField HeaderText="Include"&gt; &lt;ItemStyle CssClass="GridView_Item" /&gt; &lt;HeaderTemplate&gt; &lt;asp:CheckBox runat="server" ID="cbxIncludeAll" CssClass="label" Checked="true" Text="Include&lt;br/&gt;All" TextAlign="Left" /&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;asp:CheckBox runat="server" ID="cbxEPInclude" name="EPInclude" CssClass="EPCheckBox" Checked="true" /&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; </code></pre> <p>My HTML lies within an .ascx. The .ascx is contained on a .aspx content page. I have the JQuery library included on the Master page (I have tried in the Head, top of the body, and bottom of the body).</p>
 

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