Modal does not open in the second click

Asked

Viewed 346 times

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 far, ok! On the first click, it opened normally. I clicked the close button, and clicked again to open.

And when you click the second or next time 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);            
});

1 answer

1


You are using Bootstrap, you do not need to create a js function to open your modal, because Bootstrap itself already offers this. For this modal of yours 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>

  • Ok, friend, open it opens. However, the cancel and close buttons no longer work... Maybe it’s something modal?

  • It was something of my modal, I took the practical example even, now it worked, I will apply the load function to see.. :)

  • Perfect That was it, thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.