title: Jquery specific action for each button generated by a foreach loop
body: <p>how to create specific Jquery action for each button generated by a foreach loop?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function() {
    $("#numero").hide();
    $("#shownum").click(function(){
      $("#numero").toggle();
    });
  });
  &lt;/script&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;?php foreach ($annonces as $key =&gt; $annonce) : ?&gt;
   &lt;button type="button" class="btn btn-primary btn-xs" id="shownum"&gt; &lt;span class=" glyphicon glyphicon-earphone" aria-hidden="true"&gt; &lt;/span&gt; show/hide&lt;/button&gt;
  &lt;div id="numero"&gt;
    &lt;?php echo $annonce['Annonce']['title'] ;?&gt;
  &lt;/div&gt;
  &lt;?php endforeach; ?&gt;</code></pre>
  </div>
  </div>
  </p>