Hello Everone,
I created the code below, however, I believe I should use something like an array because when I call the function several times, then it's appending the same name(xnome) and id.
- //EXAMS
- $('#idexame').change(function () {
-
- var doc = document.getElementById("idexame");
-
- $("#xnome").html(doc.options[doc.selectedIndex].text);
-
- $(".selecionado").append('<div class="alert alert-warning alert-dismissible">
- <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
- <h4 id="xnome">'+doc.options[doc.selectedIndex].text+'</h4>
- <textarea name="sexames[]" class="form-control" rows="2" placeholder="Observação ..."></textarea>
- </div>
- <input type="hidden" name="exameid[]" value="'+doc.options[doc.selectedIndex].value +'"></input');
- });