title: check if all elements with similar IDs are selected using jQuery
body: <p>I want to check if all buttons starting with id <code>approve-</code> are selected. Buttons are dynamically created and number of buttons are not constant. </p>
  
  <pre><code>&lt;button type="button" id="approve-&lt;?php echo $item-&gt;getId();?&gt;"&gt;Approve&lt;/button&gt;
  
  &lt;button type="button" id="reject-&lt;?php echo $item-&gt;getId();?&gt;"&gt;Reject&lt;/button&gt;
  </code></pre>
  
  <p>I know about a function <code>$j("button[id^='approve-']"</code> but following code alerts "All Selected" even if one of the button is clicked.  </p>
  
  <pre><code>if($j("button[id^='approve-']")){
          alert("All Clicked");
        }
  </code></pre>