Return to Snippet

Revision: 37050
at December 3, 2010 03:36 by ivorpad


Initial Code
$.fn.focus_blur = function() {
    	$(this).css({color:'#999999'});
    	return this.focus(function() {
    		if( this.value == this.defaultValue ) {
    			this.value = "";
    		}
    		$(this).css({color:'#333333'});
    	}).blur(function() {
    		if( !this.value.length ) {
    			this.value = this.defaultValue;
    			$(this).css({color:'#999999'});
    		}
    	});
    };
    $(".input_textbox").focus_blur();

Initial URL


Initial Description


Initial Title
jQuery Input Blur

Initial Tags
jquery

Initial Language
JavaScript