Lo siguiente crea una lista de selección desplegable y un cuadro de comentarios, la lista de selección está vacía y no puedo averiguar dónde colocar las opciones dentro de la secuencia de comandos
$(document).ready(function(){ var withdrawalCharLimit = 600; buildWithdrawalDropdown(); $("#withdrawalCharRemainingGWU").text(withdrawalCharLimit-$("#withdrawalCommentsGWU").val().length); $("#withdrawalReasonGWU").change(function() { if($("#withdrawalCommentsGWU").val()==""){ $("#taComments").val($("#withdrawalReasonGWU").val()); } else { $("#taComments").val($("#withdrawalReasonGWU").val()+". Detail: "+$("#withdrawalCommentsGWU").val()); } }); $("#withdrawalCommentsGWU").keyup(function(){ if($("#withdrawalCommentsGWU").val()==""){ $("#taComments").val($("#withdrawalReasonGWU").val()); } else { $("#taComments").val($("#withdrawalReasonGWU").val()+". Detail: "+$("#withdrawalCommentsGWU").val()); } $("#withdrawalCharRemainingGWU").text(withdrawalCharLimit-$("#withdrawalCommentsGWU").val().length); }); }); function buildWithdrawalDropdown(){ var withdrawalSelect = $("<select class='form-control' id='withdrawalReasonGWU'></select>").insertBefore("#taComments"); var withdrawalComments = $("<label for='withdrawalCommentsGWU'>Additional Comments (optional):</label><textarea maxlength='600' class='form-control' id='withdrawalCommentsGWU'>")}La lista se veía así , cómo deberían cargarse las opciones