Posted By

censmedia on 10/17/12


Tagged

snippet changeval


Versions (?)

changeval input empty


 / Published in: jQuery
 

URL: www.censmedia.nl

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

  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')) } });

Report this snippet  

You need to login to post a comment.