Modal problems with jquery: Uncaught TypeError: $ (...) .modal is not a function

-2

I do not know what I'm doing to try to fix this error! Help me there, please.

NOTE: JQUERY WORKS NORMAL, SINCE I HAVE VALIDATIONS THERE. ONLY THE MODAL WORKS, I DO NOT KNOW WHY = /

        <!DOCTYPE html>
    <html lang="pt-br">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>...</title> 
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script><scriptsrc="bootstrap/js/bootstrap.min.js"></script>
        <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
        <script type="text/javascript" src="js-anuncio/cadastrese.js"></script>
        <link href="css-anuncio/style-cadastrese.css" rel="stylesheet">


    </head>
    <body>
        <div class="modal fade" id="modal-mensagem" style="display:none;">
       <div class="modal-dialog">
             <div class="modal-content">
                 <div class="modal-header">
                     <button type="button" class="close" data-dismiss="modal"><span>×</span></button>
                     <h4 class="modal-title">Título da mensagem</h4>
                 </div>
                 <div class="modal-body">
                     <p>Conteúdo da mensagem</p>
                 </div>
                 <div class="modal-footer">
                     <button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
                 </div>
           </div>
        </div>
    </div>
[...]
<button type="button" class="btn btn-warning" onclick="waitingDialog.show();">Show dialog</button>

js:

$(document).ready(function(){

            $( "#esqueci" ).click(function() {
                $( "#princ" ).toggle( "slow" );
                $( "#sec" ).toggle( "hide" );
            });

            $( "#lembrei" ).click(function() {
                $( "#sec" ).toggle( "slow" );
                $( "#princ" ).toggle( "hide" );
            });

        $( "#criarConta" ).click(function(){
            $("#modal-mensagem").modal();
            if($('#nome_completo').val() == ''){

                $('#nome_completo').css({'border-color': '#A94442'});
                $( "#nome_branco" ).toggle( "hide" );

            }else{

                $('#nome_completo').css({'border-color': '#72ACE7'});
                if($('#senha').val() == ''){

                    $('#senha').css({'border-color': '#A94442'});
                    $( "#senha_branco" ).toggle( "hide" );


                }else{
                    $('#senha').css({'border-color': '#72ACE7'});

                }
                    var sEmail = $('#email').val();
                    if (!validateEmail(sEmail)){
                            $('#email').css({'border-color': '#A94442'});
                            $( "#erro_email" ).toggle( "hide" );

                        }else{

                            if($('#email').val() == ''){

                                $('#email').css({'border-color': '#A94442'});

                            }else{

                                $('#email').css({'border-color': '#72ACE7'});

                                var dados_cadastro = $('#cadCliente').serialize(); 
                                $.ajax({
                                        url: 'cadastro_cliente.php', 
                                        type: 'post',
                                        data: dados_cadastro,
                                        success: function(data) {
                                            if (data == "200"){

                                                $( "#su_cad" ).toggle( "hide" );
                                            } else if (data == "400"){

                                                $("#su_cad").html(data).toggle( "hide" );
                                            } else {

                                                $( "#su_cad" ).toggle( "hide" );
                                            }
                                        }
                                }); 
                            }
                        }
                    }    
                });
            });

        function validateEmail(sEmail) {
            var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
            if (filter.test(sEmail)) {
                return true;
            }
            else {
                return false;
            }
    }  

    
asked by anonymous 17.11.2017 / 00:03

1 answer

0

My dear, you can solve it like this:

(function( $ ) {
    $(function() {

//codigo

 })(jQuery);

Thanks to all who are willing to help me!

    
17.11.2017 / 00:41