123456789101112131415161718192021222324252627282930313233 |
- $(function () {
- $("body").on("input propertychange", ".floating-label-form-group", function (e) {
- //$(this).toggleClass("floating-label-form-group-with-value", !!$(e.target).val());
- }).on("focus", ".floating-label-form-group", function () {
- //$(this).addClass("floating-label-form-group-with-focus");
- $(this).addClass("floating-label-form-group-with-value");
- }).on("blur", ".floating-label-form-group", function () {
- //$(this).removeClass("floating-label-form-group-with-focus");
- //$(this).removeClass("floating-label-form-group-with-value");
- //if ($('.floating-label-control').val().length == 0) {
- // $(this).removeClass("floating-label-form-group-with-value");
- //}
- if ($(this).find('.floating-label-control').val() != "") {
- $(this).addClass("floating-label-form-group-with-value");
- }
- else if ($(this).find('.floating-label-control').val() == "") {
- $(this).removeClass("floating-label-form-group-with-value");
- }
- }).on("focusin", ".floating-label-control", function () {
- $(this).attr('placeholder', $(this).data('placeholder'));
- }).on("focusout", ".floating-label-control", function () {
- $(this).attr('placeholder', $(this).data('label'));
- });
- });
- var _floatingLabelHelper = {
- init: function () {
- $('div.floating-label-form-group > input,textarea,select').each(function () {
- if ($(this).val() && !$(this).parent(".floating-label-form-group").hasClass("floating-label-form-group-with-value")) {
- $(this).parent(".floating-label-form-group").addClass("floating-label-form-group-with-value");
- }
- });
- }
- }
|