Sha256: 3f0d54d45dd69962aadfe0f42616bdf1da173328f919b6a7caaf23d43bcc215e
Contents?: true
Size: 1.32 KB
Versions: 3
Compression:
Stored size: 1.32 KB
Contents
/* --- script: Placeholder.js description: Placeholder for form fileds. license: Public domain (http://unlicense.org). authors: Yaroslaff Fedin requires: - LSD.Mixin provides: - LSD.Mixin.Placeholder ... */ LSD.Mixin.Placeholder = new Class({ options: { actions: { placeholder: { enable: function(){ this.element.set('autocomplete', 'off'); this.onPlacehold(); }, disable: function(){ this.onUnplacehold(); } } }, events: { enabled: { element: { 'focus': 'onUnplacehold', 'blur': 'onPlacehold', 'keypress': 'onUnplacehold' } } }, states: { placeheld: { enabler: 'placehold', disabler: 'unplacehold' } } }, getPlaceholder: function(){ return this.attributes.placeholder; }, onUnplacehold: function(){ if (this.placeheld){ this.applyValue(''); this.unplacehold(); return true; }; }, onPlacehold: function(){ var value = this.getRawValue(); if (!value || value.match(/^\s*$/) || value == this.getPlaceholder()){ this.applyValue(this.getPlaceholder()); this.placehold(); return true; }; } }); LSD.Behavior.define('[placeholder]', LSD.Mixin.Placeholder);
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lsd_rails-0.1.2 | Packages/lsd/Source/Mixin/Placeholder.js |
lsd_rails-0.1.1 | Packages/lsd/Source/Mixin/Placeholder.js |
lsd_rails-0.1 | Packages/lsd/Source/Mixin/Placeholder.js |