Posted By

EvanL on 03/17/12


Tagged

iejavascriptjquery


Versions (?)

Placeholder IE7 Script


 / Published in: JavaScript
 

  1. $('[placeholder]').focus(function() {
  2. var input = $(this);
  3. if (input.val() == input.attr('placeholder')) {
  4. input.val('');
  5. input.removeClass('placeholder');
  6. }
  7. }).blur(function() {
  8. var input = $(this);
  9. if (input.val() == '' || input.val() == input.attr('placeholder')) {
  10. input.addClass('placeholder');
  11. input.val(input.attr('placeholder'));
  12. }
  13. }).blur().parents('form').submit(function() {
  14. $(this).find('[placeholder]').each(function() {
  15. var input = $(this);
  16. if (input.val() == input.attr('placeholder')) {
  17. input.val('');
  18. }
  19. });
  20. });

Report this snippet  

You need to login to post a comment.