Modal does not open on second click

1

I have the following button:

<button class="btn btn-default botao_leitura_biometrica" id="" style='border: solid 1px #666'>Lectura Biométrica</button>

This should open a modal:

    <div class="modal modal-lg leitura_biometrica_modal" id="leitura_biometrica_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="z-index: 99999 !important;">
            <div class="modal-content">

                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title titulo-modal" id="myModalLabel">Busquéda por Lectura Biométrica</h4>
                </div>

                <div class="modal-body conteudo-modal-pesquisa">
                    Coloque o dedão
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default cancelar" data-dismiss="modal">Cancelar</button>
                    <a class="btn btn-danger btn-ok">Pesquisar agora!</a>
                </div>
            </div>
        </div>
    </div>  

So long, okay! On the first click, it opened normally. I clicked the close button, and clicked again to open.

And when you click on the second or next times before reload, the following error appears:

  

Uncaught TypeError: $ (...). modal is not a function

This is the opening jQuery:

$(".botao_leitura_biometrica").click(function(){
    $(".leitura_biometrica_modal").modal('show');
    var url = BASE_URL + 'ajax/pesquisar_digital';
    $(".conteudo-modal-pesquisa").load(url);            
});
    
asked by anonymous 14.09.2017 / 16:24

1 answer

1

You are using Bootstrap, you do not need to create a function in js to open its modal, since Bootstrap itself already offers this. For this your modal the button would look like this:

<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#leitura_biometrica_modal">
  Lectura Biométrica
</button>
    
14.09.2017 / 16:57