input text box and text area auto clear


/ Published in: jQuery
Save to your folder(s)

autoclear input text and text area


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.