// 'Polyfill' for :placeholder-shown, since it's not standard yet $(document).on('focus focusout', '*:not(.zuo-datepicker) > .zuo-textbox', function(e) { $("label[for='" + $(this).attr('id') + "']").toggleClass('floating', $(this).val() !== ""); }); $(document).on('change.select2', 'select', function(e) { $("label[for='" + $(this).attr('id') + "']").toggleClass('floating', !['', null].includes($(this).val())); }); $(document).on('change change.select2', '.zuo-form-group.has-error > input, .zuo-form-group.has-error > select', function(e) { $(this).parent('.zuo-form-group').removeClass('has-error'); }); $(document).on('show', '.zuo-datepicker', function(e) { $(this).children('.zuo-floating-label').addClass('floating'); }); $(document).on('hide', '.zuo-datepicker', function(e) { $(this).children('.zuo-floating-label').toggleClass('floating', !!e.date); });