title: I can only change the ID of the first select of my cloned divs
body: <p>I have a div in html with a select inside which i am cloning every time i click the addMaterial () button, the jQuery code works as follows, i create the cloning I change the ID name of the div being cloned (that works perfect) and at the same time i also change the name of the select ID that contains that div. The problem is that only the ID of the select of the first click changes (that is, the first cloning) in the following the ID of the select keeps it by default. A clarification $ num is a variable i passed from the laravel controller with a value of 0.</p>
  
  <p><strong>Code Html div and select</strong></p>
  
  <pre><code>  &lt;div id="div-materiales-{{$num}}" class="form-group"&gt;
      &lt;label&gt;Artículos&lt;/label&gt;
      &lt;div class="input-group"&gt;
          &lt;div class="input-group-addon"&gt;
              &lt;i class="fas fa-fw fa-calendar"&gt;&lt;/i&gt;
          &lt;/div&gt;
          &lt;select class="form-control widthInput articulo-{{$num}}" id="articulo-{{$num}}" name="articulo-{{$num}}"&gt;
              @foreach ($articulos as $articulo)
  
              &lt;option value="{{$articulo-&gt;id}}"&gt;{{ $articulo-&gt;codigo.". ".$articulo-&gt;descripcion }}&lt;/option&gt;
  
              @endforeach
  
          &lt;/select&gt;
      &lt;/div&gt;
  &lt;/div&gt;  
  </code></pre>
  
  <p></p>
  
  <pre><code> &lt;button class="btn btn-block btn-lg" id="addMaterial" type="button"&gt;+ Añadir concepto&lt;/button&gt;
  </code></pre>
  
  <p><strong>Code jQuery</strong></p>
  
  <pre><code>var i = 1;          
  $( "#addMaterial" ).click(function() {
  
      $('#div-materiales-{{$num}}').clone().appendTo('#material-form').prop('id', 'div-materiales-' + i);
  
      $("#articulo-{{$num}}").removeAttr("id");
      $("#articulo-{{$num}}").attr("id","articulo-" + i);
  
  
      i++; 
  
      });
  </code></pre>
  
  <p>Here in the image you can check how the first cloning has changed the id of the select to article-1 but the following ones no longer do it and by default it puts article-0
  <a href="https://i.stack.imgur.com/nQR3A.png" rel="nofollow noreferrer">enter image description here</a></p>