jquery placeholder for forms in IE


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



Copy this code and paste it in your HTML
  1. $(function() {
  2.  
  3. $("#emaillist input[type='text']").attr( 'value', 'enter email' );
  4.  
  5. $("#emaillist input[type='text']").focus(function () {
  6. var value = $("#emaillist input[type='text']").attr( 'value');
  7. if (value == 'enter email'){
  8. $(this).addClass('black');
  9. $("#emaillist input[type='text']").attr( 'value', '' );
  10. }
  11. });
  12.  
  13. $("#emaillist input[type='text']").focusout(function () {
  14. var value = $("#emaillist input[type='text']").attr( 'value');
  15. if (value == '' || value == 'enter email'){
  16. $(this).removeClass('black');
  17. $("#emaillist input[type='text']").attr( 'value', 'enter email' );
  18. }
  19. });
  20.  
  21. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.