title: jquery - selecting unique id
body: <p>i'm new to jquery</p>
  
  <p>i generated html div with php and give each them a unique id</p>
  
  <pre><code>&lt;div id=div1&gt;text&lt;/div&gt;
  &lt;div id=div2&gt;text&lt;/div&gt;
  &lt;div id=div3&gt;text&lt;/div&gt;
  ...
  </code></pre>
  
  <p>the problem is, how I select specific div with jquery? usually i use this code to select an element</p>
  
  <pre><code>$('#id')
  </code></pre>
  
  <p>but I have to make alot of selector because each id is unique. Recently I used something like this </p>
  
  <pre><code>&lt;div ... onclick=getElem(id)&gt;&lt;/div&gt;
  
  function getElem(id){
       var elem=$('#div'+id);
  } 
  </code></pre>
  
  <p>Is it good to use <code>onclick</code>?</p>