title: How to Find a CheckBox inside a Class and Hide the CheckBox using JQuery?
body: <p>I have a <code>Grid view</code> in which their is a <strong>CheckBox</strong> in first column. Now, i want to Hide a <code>CheckBox</code> of selected Row.
  I have tried with the following to Hide <code>CheckBox</code> but it wont work.</p>
  
  <pre><code>&lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AllowPaging="true"
      PageSize="100" AllowSorting="true" DataSourceID="sqlUsers" DataKeyNames="ttppcid"
      Width="100%" OnRowCommand="GridView1_RowCommand" EmptyDataText="No Data Found"
      OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDataBound="GridView1_RowDataBound"&gt;
      &lt;Columns&gt;
          &lt;asp:TemplateField ItemStyle-Width="30px" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" Visible="true"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:CheckBox ID="chkSelect" runat="server" Height="30" class="mychk" rowid="&lt;%# Container.DataItemIndex+1 %&gt;" /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
  //some more templates here
          &lt;asp:TemplateField HeaderText="" ItemStyle-Width="70px" ItemStyle-HorizontalAlign="Center"
              HeaderStyle-HorizontalAlign="Center"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Button ID="BtnSource" runat="server" Text="Source" rowid="&lt;%# Container.DataItemIndex+1 %&gt;"
                      class="showButton" OnClick='&lt;%# "return SetRowValues("+Eval("ttppcid")+",this.id,"+Eval("Fair")+","+Eval("Good")+","+Eval("Mint")+","+Eval("Poor")+","+Eval("Fair")+")"%&gt;' /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>function SetRowValues(id, controlid, fair, good, mint, nnew, poor, broken) {
      var rowid = $("#" + controlid).attr("rowid");
      var chkBoxID;
      var chkRowid;
      $('.mychk').css("display", "block");
  
      $('.mychk').each(function() {
  
          chkBoxID = this.id;
          alert(chkBoxID);
          chkRowid = $("#" + chkBoxID).attr("rowid");
          alert(chkBoxID + " ROW :" + chkRowid);
  
  
          if (chkRowid == rowid) {
              $("#" + chkBoxID).css("display", "none");
          }
          else {
              $("#" + chkBoxID).css("display", "block");
  
          }
      });
  return false;
  }
  </code></pre>
  
  <p><strong>AlsoTRied With:</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function() {
      $(function() {
          $(".showButton").on("click", function() {
              alert(".showButton clicked");
              $(this).closest("tr").find(":checkbox").hide();
          });
      });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Rendered Markup:</strong></p>
  
  <p>Rendered CheckBox:</p>
  
  <pre><code>&lt;td align="center" style="width: 30px; display: block;"&gt;
     &lt;span class="mychk" rowid="1" style="display: block; height: 30px;"&gt;&lt;input id="ctl00_ContentPlaceHolder1_GridView1_ctl02_chkSelect" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl02$chkSelect"&gt;&lt;/span&gt;
  &lt;/td&gt;
  
  **Rendered Button in Grid:**
  &lt;td align="center" style="width: 70px; display: block;"&gt;
   &lt;input type="submit" name="ctl00$ContentPlaceHolder1$GridView1$ctl03$BtnSource" value="Source" onclick="return SetRowValues(6,this.id,222.0000,222.0000,222.0000,222.0000,222.0000);WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&amp;quot;ctl00$ContentPlaceHolder1$GridView1$ctl03$BtnSource&amp;quot;, &amp;quot;&amp;quot;, true, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, false, false))" id="ctl00_ContentPlaceHolder1_GridView1_ctl03_BtnSource" class="showButton" rowid="1" style=""&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p><strong>NOTE: I want to hide the CheckBox where 'rowid' of Button matches with the 'rowid' of a CheckBox.</strong></p>