title: jQuery -Wildcard Selector Starts w/String and ends w/Variable
body: <p>I've been looking all over the web for an example or solution, but have not been successful yet.  The challenge I am facing is using jQuery to select an element ID that starts with a string, but also ends with a variable passed in by a function.</p>
  
  <p><strong>Example:</strong></p>
  
  <p>.JSP file - There is a ForEach loop that creates dynamic divs and adds a variable ${number} to their 'id' as a key.  This allows a button to show/hide only that unique div without impacting other divs on the same page.</p>
  
  <pre><code>&lt;div id="success-icon${number}"&gt;&lt;/div&gt;
  &lt;div id="success-msg${number}"&gt;&lt;p&gt;My Message&lt;/p&gt;&lt;/div&gt;
  
  &lt;button id="success-btn${number}" onclick="showIcon(${number})"&gt;Show Button ${number}&lt;/button&gt;
  </code></pre>
  
  <p>.JS file</p>
  
  <pre><code>//does not work, because it is looking for success+number
  function showIcon(number){
      $('[id^=success]'+number).show();
  }
  </code></pre>
  
  <p>I need it to look for an id that starts with "success" and ends with "number" variable. </p>
  
  <p>Would really appreciate any help on this and thanks in advance for your time!</p>