Checkboxes inside a gridview ItemTemplate with jQuery
<p>I have an ASP.NET GridView with Checkboxes inside an ItemTemplate. I am simply needing to check (with jQuery) whether any of them are selected so as to accomplish something else. Using the code below nothing is happening. If I give the CheckBoxes an ID it will work but only the first checkbox. </p>

<p>Here is the GridView:</p>

<pre><code> &lt;asp:GridView ID="gvData" runat="server" AutoGenerateColumns="false" SkinID="GridView"
            DataKeyNames="Check Config"&gt;
            &lt;Columns&gt;
                &lt;asp:BoundField HeaderText="Schedule ID" DataField="Check Config"&gt;&lt;/asp:BoundField&gt;
                &lt;asp:BoundField HeaderText="Check Configuration" DataField="Check Configuration" /&gt;
                &lt;asp:BoundField HeaderText="Shift" DataField="Shift" /&gt;
                &lt;asp:BoundField HeaderText="Earliest Time" DataField="Earliest Time" /&gt;
                &lt;asp:BoundField HeaderText="Alarm Time" DataField="Alarm Date" /&gt;
                &lt;asp:BoundField HeaderText="Disposition" DataField="Disposition" /&gt;
                &lt;asp:TemplateField HeaderText="Disable"&gt;
                    &lt;ItemTemplate&gt;
                        &lt;asp:CheckBox runat="server" CssClass="alarmSelections" /&gt;
                    &lt;/ItemTemplate&gt;
                &lt;/asp:TemplateField&gt;
            &lt;/Columns&gt;
        &lt;/asp:GridView&gt;
</code></pre>

<p>And here is the jQuery (edited for more clarification):</p>

<pre><code> //if some or all rows are selected, create the html button "btnEnterComment"
            $('[id$="gvData"]').change(function () {
                //check to see if the button already exists
                if ($('#divButtonHolder').hasClass('classFlag')) {
                    return;
                }
                else {
                    if ($('.alarmSelections:checked').length) {
                        $('#divButtonHolder').html('&lt;input type="button" id="btnEnterComment" value="Disable Marked Alarms" style="border: 2px solid green; background-color: #fff;height: 25px; cursor: hand;"&gt;&lt;/input&gt;');
                        $('#divButtonHolder').addClass('classFlag');
                    }


                }
</code></pre>
