Sign in or Join FriendFeed
FriendFeed is the easiest way to share online. Learn more »
Patrick McCarthy
Muhammad Haris - How To Correctly Remove Default Values From Form Fields On Focus With Javascript - http://www.mharis.net/how-to-...
jQuery(document).ready(function() { var default_values = {}; jQuery('input, textarea').each(function(i) { var index = jQuery(this).attr('name'); var value = jQuery(this).val(); default_values[index] = value; }); jQuery('input, textarea').focus(function() { if(jQuery(this).val() === default_values[jQuery(this).attr('name')]) { jQuery(this).val(''); }; }) }); - Patrick McCarthy