nickberens360
10/12/2016 - 3:37 PM

wp contact form 7 float label

wp contact form 7 float label

jQuery(document).ready(function ($) {


    $(function () {
        var onClass = "on";
        var showClass = "show";
        var labelOn = "labelOn";

        $(".js-floatInput").bind("checkval", function () {
            var label = $(this).closest('.formGroup ').find(".js-floatLabel");
            if (this.value !== "") {
                label.addClass(showClass);
                $(this).closest('.formGroup ').addClass(labelOn);
            } else {
                label.removeClass(showClass);
                $(this).closest('.formGroup ').removeClass(labelOn);
            }
        }).on("keyup", function () {
            $(this).trigger("checkval");
        }).on("focus", function () {
            $(this).closest('.formGroup ').find(".js-floatLabel").addClass(onClass);

        }).on("blur", function () {
            $(this).closest('.formGroup ').find(".js-floatLabel").removeClass(onClass);
        }).trigger("checkval");
    });


});