Module: Text


Add support for placeholder in browsers that don't natively support it. Options can be passed to extend the defaults. When adding custom validators they will force the placeholder to appear when failing validation.


var DEFAULTS = {
     active: true, // active by default
     force: false, // force to use custom placeholders even when browser natively support it.
     ready: function() {}, // callback when module is ready.
     blur_color: '#777', // blur color used to mimic placeholder color.
     classPrefix: 'custom-', // prefix used for class.
     placeholder_support: (function() { // this is used to check if placeholder support is enabled.
         return ('placeholder' in global.document.createElement('input'));
     element: obj, // input ('text', 'search', 'tel', 'url', 'email', 'password') field.
     events: [], // custom events can be added.
     validators: [] // custom validators can be added.