title: Check whether a class exists in any row of a table in JavaScript
body: <p>I have a table (simplified for this question):</p>
  
  <pre><code>&lt;table&gt;&lt;br&gt;
    &lt;tr onclick="selectRow"&gt;&lt;br&gt;
      &lt;td&gt;table data&lt;/td&gt;&lt;br&gt;
      &lt;td&gt;table data&lt;/td&gt;&lt;br&gt;
      &lt;td&gt;table data&lt;/td&gt;&lt;br&gt;
    &lt;/tr&gt;&lt;br&gt;
    &lt;tr class="selected" onclick="selectRow"&gt;&lt;br&gt;
      &lt;td&gt;table data&lt;/td&gt;&lt;br&gt;
      &lt;td&gt;table data&lt;/td&gt;&lt;br&gt;
      &lt;td&gt;table data&lt;/td&gt;&lt;br&gt;
    &lt;/tr&gt;&lt;br&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p><code>class="selected"</code> is a result of clicking on the row.
  I want to make a button that when clicked, would return true if there is a row with the class 'selected', and false if there is not.</p>
  
  <p>Any help is greatly appreciated.</p>