2
I need to close and limpar
the content of a modal. When opening it I have a search field where I perform a search in my bd
, and by clicking the button enviar
I close it by passing some parameters.
But when calling the modal for a new search the previous search is still there. I have this code that sends the parameters and closes the modal:
<button type="button" class="btn btn-primary btn-mini" data-toggle="modal" data-dismiss="modal" onclick="mostraDados('parâmetros')"> enviar </button>
The called function is this:
function mostraDados(pIdCooperante,pNome,pIdPropriedade,pVistoria,pUF,pIdMunicipio){ // ATRIBUINDO VALORES RETORANDOS AOS CAMPOS $("#ID").val(pIdCooperante); $("#Cooperante").val(pNome); $("#Propriedade").val(pIdPropriedade); $("#Vistoria").val(pVistoria); $("#UF").val(pUF); $("#Municipio").val(pIdMunicipio); }
Had made some tests using the command $('#ModalCooperante').modal('hide');
but this only hides the modal and when I call again the previous research still remains.
Tries
$('#ModalCooperante').dialog('destroy').remove()
– Sorack
Hello @Sorack, thanks for the tip, but it’s not working yet.
– adventistapr