I need to close and limpar
the contents of a modal. When I open it I have a search field where I perform a search in my bd
, and when I click on the enviar
button 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); }
I had done some tests using the command $('#ModalCooperante').modal('hide');
but this only hides the modal and when I call it again the previous search still remains.