Using focus and blur on input with jQuery


/ Published in: jQuery



Copy this code and paste it in your HTML
  1. $(document).ready(function() {
  2.  
  3. $("input[type='text']").focus(function() {
  4. if($(this).val() == 'here your text')
  5. $(this).val("");
  6. });
  7.  
  8. $("input[type='text']").blur(function() {
  9. if($(this).val() == "")
  10. $(this).val("here your text");
  11. });
  12.  
  13.  
  14. });

URL: http://tcelestino.com.br

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.