Posted By

silent_killer on 04/26/12


Tagged

jquery


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

BrockSamsom


input text box and text area auto clear


 / Published in: jQuery
 

autoclear input text and text area

  1. $(function(){
  2. $('input:text, textarea').each(function(){
  3. var txtval = $(this).val();
  4. $(this).focus(function(){
  5. $(this).val('')
  6. });
  7. $(this).blur(function(){
  8. if($(this).val() == ""){
  9. $(this).val(txtval);
  10. }
  11. });
  12. });
  13. });

Report this snippet  

You need to login to post a comment.