0
Good morning! I’ll rephrase the question: mount a table that receives data and a link to edit this data. So far so good.
The click on this link should open the modal for data editing. I already checked the references to Bootstrap and Jquery and I can’t understand why I still show the error message: Uncaught Typeerror: $(...). modal is not a Function
Below the snippets of my code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
Edit
<div class="modal" id="modalUsuario">
<div class="modal-dialog">
<div class="modal-content">
<!-- Cabeçalho do Modal -->
<div class="modal-header">
<h3 id="myModalLabel"></h3>
</div>
<!-- Corpo do Modal -->
<div class="modal-body">
<div class="container">
<div class="row">
<div class="col-md-12">
<input class = "form-control" type="text" id="txtNomeCidade" name="txtNomeCidade" placeholder = "Nome da cidade" style="width:auto;"/><br/>
</div>
</div><br/>
<div class="row">
<div class="col-md-12">
<textarea class = "form-control" style="width:auto;" class="form-control" id="informacoes" name="informacoes" rows="5" cols="33" placeholder="Informações sobre a cidade"/></textarea><br/>
</div>
</div><br/>
</div>
</div>
<!-- Rodapé do Modal -->
<div class="modal-footer">
<div id="mensagem_modal_edita_cidade"></div>
<button id="btnSalvarAlteracao" class="btn btn-success">Salvar alteração</button>
<button class="btn btn-danger" data-dismiss="modal">Fechar</button>
<div class="spinner-border" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
</div>
</div>
<script>
function carregarModalEdicaoUsuario(id){
$("#modalUsuario").modal("show");
};
</script>
You don’t need to create a script to open the modal if you use HTML correctly.
– Sumback
No need to put
javascript:
within theonclick
. Code within this attribute is already Javascript. Just call only the function:onclick="carregarModalAlterarSenha();"
.– Sam