Dynamic form locking select

0

I have a dynamic form ( that ) with two fields (a SELECT and a quantity input), but every time I I add two more fields SELECT is locked.

$(document).ready(function(){
var itemCont = 1;
$("#novoProd").click(function(){
  var novoItem = $("#item").clone();
  // modifica o id do item recem criado
  $(novoItem).attr("id","item"+itemCont);
  var novoSelect = $(novoItem).children()[1];
  $(novoSelect).attr("id","produtoId"+itemCont);
  $(novoSelect).attr("name","produtoId[]"+itemCont);

  var novoSelect = $(novoItem).children()[3];
  $(novoSelect).attr("id","quant"+itemCont);
  $(novoSelect).attr("name","quant[]"+itemCont);

  $("#formulario").append(novoItem);
  itemCont++;
  $("#itemCont").val(itemCont);
});

I'm using the Chosen plugin to create the search field in SELECT, without it the form works normal.

<select data-placeholder="Choose a Country..." class="chosen-select"  id="produtoId" name="produtoId[]">
    
asked by anonymous 30.01.2018 / 12:36

0 answers