Revision: 27397
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 5, 2010 11:27 by minky
Initial Code
/* * @package pwDefaultValue * @description pwDefaultValue - uses input value as a label while the input is empty * @author Jared Clarke <[email protected]> * @copyright 2010 (c) Jared Clarke @ Pixaweb.co.uk * @version 0.1 */ (function($) { $.fn.pwDefaultValue = function(options) { var opts = $.extend({}, options, $.fn.pwDefaultValue.defaults); return this.each( function() { var _this = $(this), _default = this.defaultValue; _this.bind("focus", function(event) { var _value = $(this).val(); if(_value == _default) { $(this).val(""); } }).bind("blur", function(event) { var _value = $(this).val(); if(_value.length == 0 || _value == "") { $(this).val(_default); } }); return _this; }); }; $.fn.pwDefaultValue.defaults = {}; })(jQuery);
Initial URL
http://www.pixaweb.co.uk/resources?tag=jquery
Initial Description
## PWDefaultValue This jQuery Plugin allows you to set a label-like default value on an input which is toggled depending on whether the user has entered any content into the input element. Examples and such are available on http://www.pixaweb.co.uk/resources
Initial Title
PWDefaultValue - A jQuery Form-Assistant Plugin
Initial Tags
jquery
Initial Language
jQuery