/ Published in: jQuery
autoclear input text and text area
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$(function(){ $('input:text, textarea').each(function(){ var txtval = $(this).val(); $(this).focus(function(){ $(this).val('') }); $(this).blur(function(){ if($(this).val() == ""){ $(this).val(txtval); } }); }); });