• Olá, boa tarde!

    Primeiramente, agradeço pelo plugin que é sensacional e estou adorando utilizar.

    Mas fiz uma interface pro formulário utilizando labels flutuantes, como o plugin Material Design limita o uso de outros plugins e elementos do Contact Form 7 eu optei fazer o efeito do float label manualmente.

    O problema então ficou o seguinte, quando o campo é auto preenchido o javascript não identifica que o input não está vazio, as soluções que vi na internet referiam utilizar o identificar de autopreenchimento do chrome (-webkit-autofill) ou identificar pelo placeholder, mas nenhuma das situações se encaixam com a estrutura deste plugin.

    Você saberia me dizer o que eu poderia fazer?

    No caso meu javascript hoje está assim:

    jQuery(document).ready(function($) { 
        $("input, textarea").each(function() {
            if ($(this).val().length != 0) {
                $(this).parent().siblings("label").addClass("float-label");
            } else {
                $(this).parent().siblings("label").removeClass("float-label");
            }
        });
        $("input, textarea").focus(function() { 
            $(this).parent().siblings("label").addClass("float-label");
        });
        $("input, textarea").focusout(function() { 
            if ($(this).val().length == 0) {
                $(this).parent().siblings("label").removeClass("float-label");
            }
        });
    });
    • This topic was modified 4 years, 1 month ago by paularillo.

    The page I need help with: [log in to see the link]

  • The topic ‘Label flutuante e o autofill’ is closed to new replies.