changeval input empty


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

Small function to create a replacement for the placeholder functionality in HTML5. This works in IE as well.


Copy this code and paste it in your HTML
  1. $('input.empty').focus(function(){ if($(this).val() == $(this).attr('data-placeholder')){ $(this).val('') } });
  2.  
  3. $('input.empty').blur(function(){ if($(this).val() == ''){ $(this).val($(this).attr('data-placeholder')) } });

URL: www.censmedia.nl

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.