Lightweight \"label inside input field\" snippet


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



Copy this code and paste it in your HTML
  1. var field = $('input');
  2. field.focus(function(){
  3. if(field.val()==='Your Name')
  4. field.val('')
  5. }).blur(function(){
  6. if(field.val()==='')
  7. field.val('Your Name')
  8. })

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.