I have a modal that opens when I click on a link, in this modal I'm going to type an email that, when I click on add email , will add the email text in <ul> <li>
below of the input .
I have already made a code that follows from an example, I have already debugged the data and they are all correct; but the email is not yet listed.
My Modal:
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Enviar relatório por email</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="recipient-name" class="col-form-label">E-Mail:</label>
<input type="text" class="form-control" id="recipient-email">
</div>
<div class="form-group">
<label for="message-text" class="col-form-label">Destinários</label>
<ul id="ListEmail"></ul>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="adicionarEmail">Add E-Mail</button>
<button type="button" class="btn btn-primary salvarEnviar">Salvar</button>
</div>
</div>
</div>
</div>
My javascript:
document.getElementById("adicionarEmail").onclick = function () {
var text = document.getElementById("recipient-email").value;
var li = '<li>' + text + '</li>';
document.getElementById("ListEmail").appendChild(li);
}