title: How to name select id element using jquery each looping?
body: <p>I want to implement jquery select2 plugin into a form. I have a problem with naming the textbox so that the select2 can be triggered. Here is the html:</p>
  
  <pre><code>&lt;select id="select1"&gt;&lt;/select&gt;
  &lt;select id="select2"&gt;&lt;/select&gt;
  &lt;select id="select3"&gt;&lt;/select&gt;
  </code></pre>
  
  <p>And here is the code to retrieve data from database:</p>
  
  <pre><code>$('#select').select2({
          ajax: {
                  url: "get_member.php",
                  dataType: 'json',
                  delay: 200,
                  data: function (params) {
                      return {
                          q: params.term
                      };
                  },
                  processResults: function (data) {
  
                      return {
                          results: data
                      };
                  },
                  cache: true
              }
          });
  </code></pre>
  
  <p>How can I change the id element from select to select1, select2 etc? I read that it is possible to use jquery each loop but I don't know how.</p>