forked from maman/JVFloat.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jvfloat.min.js
2 lines (2 loc) · 946 Bytes
/
jvfloat.min.js
1
2
/* JVFloat.js v1.0.0 - Generated on: 2014-09-18 */
!function(a){"use strict";a.fn.jvFloat=function(){return this.filter("input:not([type=submit]), textarea, select").each(function(){function b(a){var b=a.attr("placeholder");return"undefined"==typeof b&&(b=a.attr("title")),b}function c(){var a=f.val();if(null==a)a="";else if(f.is("select")){var c=b(f);c==a&&(a="")}i.toggleClass("active",""!==a)}function d(){var b="";do b=("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).substr(-4);while(a("#"+b).length);return b}function e(a){var b=d();return a.prop("id",b),b}var f=a(this).wrap("<div class=jvFloat>"),g=f.attr("id");g||(g=e(f));var h=f.attr("required")||"",i="",j=b(f);i=a(this).is("textarea")?a('<label class="placeHolder textarea '+h+'" for="'+g+'">'+j+"</label>").insertBefore(f):a('<label class="placeHolder '+h+'" for="'+g+'">'+j+"</label>").insertBefore(f),c(),f.bind("keyup blur",c)})}}(window.jQuery||window.Zepto||window.$);