jQuery validate does not work in modal

0

I have a modal with a form. I used this plugin to create the modal: link

I also use jquery validate.

It works on all forms of my site. But in the form that is within my modal it does not work.

Does anyone have any ideas?

HTML:

        <form id="form-contato" action="enviar.php" method="post">

            <h5>Deixe sua mensagem</h5>

            <input type="hidden" name="field-home">

            <div>
                <label>Nome <span>*</span></label><br>
                <input type="text" name="nome_completo" class="input-full" required="true">
            </div>

            <div>
                <label>E-mail <span>*</span></label><br>
                <input type="email" name="email" class="input-full" required="true">
            </div>

            <div>
                <label>Telefone</label><br>
                <input type="text" name="telefone" class="input-half">
            </div>

            <div>
                <label>Assunto </label><br>
                <input type="text" name="assunto" class="input-full">
            </div>

            <div>
                <label>Mensagem <span>*</span></label>
                <textarea name="mensagem" class="input-textarea" required="true"></textarea>
            </div>

            <button type="submit" class="enviar">
                Enviar <i class="fa fa-paper-plane" aria-hidden="true" style="margin-left: 5px;"></i>
            </button>

<script>
$("#form-contato").validate({
            rules : {
                nome_completo: {
                    required:true
                },
                email: {
                    required:true,
                    email:true
                },
                mensagem: {
                    required:true
                }
            },
            messages:{
                nome_completo: {
                    required: "Campo obrigatório."
                },
                email:{
                    required: "Campo obrigatório.",
                    email: "Informe um e-mail válido."
                },
                mensagem: {
                    required: "Campo obrigatório."
                }
            }
        });
</script>
    
asked by anonymous 17.01.2018 / 12:40

0 answers