/ Published in: JavaScript
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
(function($){
$.fn.clearDefault = function(){
return this.each(function(){
var default_value = $(this).val();
$(this).focus(function(){
if ($(this).val() == default_value)
$(this).val("");
});
$(this).blur(function(){
if ($(this).val() == "")
$(this).val(default_value);
});
});
};
})(jQuery);
// How to use it: $('input').clearDefault();
Comments
 Subscribe to comments
                    Subscribe to comments
                
                