title: How to check if any row in the table has a button of type "submit"?
body: <p>I have an asp page where <code>gridview</code> generates an html page.</p>
  
  <p>This page has a table that may or may not contain "Edit" buttons on the rows.</p>
  
  <p>How can I check if the table has these buttons?</p>
  
  <p>I'm using the following logic:</p>
  
  <pre><code>if ($('#cphBody_gvBins').closest('tr').find('input[name=edit]').length &gt; 0) {
     //do something
  }
  </code></pre>
  
  <p>But it always returns false</p>
  
  <p>The following fragment is my html table:</p>
  
  <pre><code>&lt;table class="DataWebControlStyle" cellspacing="0" rules="all" border="1" id="cphBody_gvBins" style="border-collapse:collapse;"&gt;
          &lt;tr class="ui-state-default" style="height:40px;"&gt;
              &lt;th class="binGridHeader" scope="col" style="width:80px;"&gt;&lt;a href="javascript:__doPostBack(&amp;#39;ctl00$cphBody$gvBins&amp;#39;,&amp;#39;Sort$Bin&amp;#39;)"&gt;Bin&lt;/a&gt;&lt;/th&gt;&lt;th class="binGridHeader" scope="col" style="width:80px;"&gt;Min Value&lt;/th&gt;&lt;th class="binGridHeader" scope="col" style="width:80px;"&gt;Max Value&lt;/th&gt;&lt;th class="binGridHeader" scope="col" style="width:80px;"&gt;&lt;a href="javascript:__doPostBack(&amp;#39;ctl00$cphBody$gvBins&amp;#39;,&amp;#39;Sort$Currency&amp;#39;)"&gt;Currency&lt;/a&gt;&lt;/th&gt;&lt;th class="binGridHeader" scope="col" style="width:380px;"&gt;&lt;a href="javascript:__doPostBack(&amp;#39;ctl00$cphBody$gvBins&amp;#39;,&amp;#39;Sort$Description&amp;#39;)"&gt;Description&lt;/a&gt;&lt;/th&gt;&lt;th class="binGridHeader" scope="col" style="width:120px;"&gt;&lt;a href="javascript:__doPostBack(&amp;#39;ctl00$cphBody$gvBins&amp;#39;,&amp;#39;Sort$LastUpdated&amp;#39;)"&gt;Last Updated&lt;/a&gt;&lt;/th&gt;&lt;th class="binGridHeader" scope="col" style="width:160px;"&gt;&lt;a href="javascript:__doPostBack(&amp;#39;ctl00$cphBody$gvBins&amp;#39;,&amp;#39;Sort$LastUpdatedBy&amp;#39;)"&gt;Last Updated By&lt;/a&gt;&lt;/th&gt;&lt;th class="binGridHeader" scope="col" style="width:60px;"&gt;Relocate&lt;/th&gt;&lt;th scope="col" style="width:140px;"&gt;&amp;nbsp;&lt;/th&gt;
          &lt;/tr&gt;&lt;tr class="odd"&gt;
              &lt;td&gt;
                      &lt;span id="cphBody_gvBins_lblBin_0"&gt;409275&lt;/span&gt;
              &lt;/td&gt;&lt;td&gt;
                      &lt;span id="cphBody_gvBins_lblMinVal_0"&gt;00&lt;/span&gt;
              &lt;/td&gt;&lt;td&gt;
                      &lt;span id="cphBody_gvBins_lblMaxVal_0"&gt;99&lt;/span&gt;
              &lt;/td&gt;&lt;td&gt;
                      &lt;span id="cphBody_gvBins_lblCurrency_0"&gt;PLN&lt;/span&gt;
              &lt;/td&gt;&lt;td&gt;
                      &lt;span id="cphBody_gvBins_Label22_0"&gt;&lt;/span&gt;
              &lt;/td&gt;&lt;td&gt;
                      &lt;span id="cphBody_gvBins_Label24_0"&gt;14/03/2019 12:13 PM&lt;/span&gt;
              &lt;/td&gt;&lt;td&gt;
                      &lt;span id="cphBody_gvBins_Label25_0"&gt;System&lt;/span&gt;
              &lt;/td&gt;&lt;td&gt;
                      &lt;input id="cphBody_gvBins_cbRelocateBin_0" type="checkbox" name="ctl00$cphBody$gvBins$ctl02$cbRelocateBin" /&gt;
              &lt;/td&gt;&lt;td&gt;
                  &lt;input type="submit" name="ctl00$cphBody$gvBins$ctl02$btnBinEdit" value="Edit" id="cphBody_gvBins_btnBinEdit_0" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" /&gt;
                  &lt;input type="submit" name="ctl00$cphBody$gvBins$ctl02$btnBinRemove" value="Remove" id="cphBody_gvBins_btnBinRemove_0" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" /&gt;
              &lt;/td&gt;
  
  .
  .
  .
  &lt;/table&gt;
  </code></pre>
  
  <p>What is the right way to do it?</p>