title: Determine if $(this) element within jQuery each loop hasClass like a string
body: <p>Within a jQuery each loop, how can I determine if a selected $(this) element contains a class with a name 'like' a specific value.  Initially hasClass() looked promising, but it's unclear to me how to use that function to handle this.</p>
  
  <p>Here is the markup.</p>
  
  <pre><code>&lt;div class="command_buttons"&gt;
      &lt;a class="download_left_button" style="display:none;" href="#"&gt;&lt;/a&gt;
      &lt;a class="bookmark_left_button" href="#"&gt;&lt;/a&gt;
      &lt;a class="search_right_button" href="#"&gt;&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is the JavaScript.</p>
  
  <pre><code>findButtonPositionOnCommandBar = function (buttonType) {
    /* This function returns 'solo', 'left', 'center', or 'right' text
       to tell the button position. The buttonType param should match
       a button class prefix like 'bookmark', 'search', or 'download'. */
  
    if ($('.command_buttons').length == 0) { return ''; } // Command bar not found.
  
    // How many visible buttons are on the first command bar found on the page?
    var $visibleButtons = $('.command_buttons:first a:visible');
    var numberOfButtons = $($visibleButtons).length;
    if (numberOfButtons == 0) { return ''; }
    if (numberOfButtons == 1) { return 'solo'; }
  
    // This is where I'm having difficulty.
    // Find the button with a class name LIKE buttonType_.
    buttonSelector = 'class*=' + buttonType + '_'; 
    $($visibleButtons).each(function (index) {
       if ($(this).hasClass(buttonSelector)) {
          alert('true: ' + index);
       } else {
          alert('false: ' + index);
       }
    });
  },
  </code></pre>
  
  <p>For instance, with the above function if we passed 'bookmark' to the buttonType parameter, then it needs to locate anchor tag which has a class of 'bookmark_left_button'.</p>
  
  <p>We have a variety of buttons that can appear in various positions.  So I would prefer to find 'bookmark_' rather than write a select for all the permutations of classes that we can apply to the buttons (i.e. bookmark_left_button, bookmark_center_button, bookmark_right_button, download_left_button, etc).</p>
  
  <p>Thanks for your help.</p>