title: jquery .click function onto a while loop
body: <p>Good afternoon,</p>
  
  <p>So I have this simple loop and basically I'd like to create an event for anytime the user clicks on any line created by the loop.</p>
  
  <p>This is my very simple php while loop:</p>
  
  <pre><code>&lt;?php
  $x = 1; 
  while($x &lt;= 5) {
      ?&gt;
      &lt;div id="number"&gt;&lt;?php echo "$x &lt;br&gt;";?&gt;&lt;/div&gt;&lt;?php
      $x++;
  }
  ?&gt;
  </code></pre>
  
  <p>and this is my jquery:</p>
  
  <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  $(document).ready(function(){
      $("#number").click(function(){
          alert("click");
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Unfortunately, the alert only activates itself when I click on the first number.
  Is there anything I am doing wrong?</p>
  
  <p>Edit:I feel very dumb, I should've used class instead, thanks Tushar</p>