0
someone would tell me why this block of code only works after refreshing the page?
var count = 0;
$( document ).ready(function() {
//  alert("testando bloco");
  $("#select_n").attr('id', 'select_' + count);
  $("#add").click(function(){
    count ++;
    // desnecessario
    $("#select_n").attr('id', 'select_' + count);
    //$("#filtro_subdisciplinas_select").attr('id', 'subdisciplinas_select_' + count);
    $("#subdisciplina_select_n").attr('id', 'subdisciplina_select_' + count);
    //$("#carro_div_n").attr('id', 'carro_div_' + carro_temp);
  });
});
						
is that the #add button generates another field with id $("#select_n"), it does not appear there because it does so through a framework called Gem in ruby on Rails
– Erasmo Santos
Try to show more information in your question @Erasmosantos. I do not use ruby on Rails any further than I said no error in this piece of code.
– Hozeis