Modernizr Placeholder


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



Copy this code and paste it in your HTML
  1. if (!Modernizr.input.placeholder){
  2.  
  3. $('input[type=text]').each( function(){
  4. $(this).attr('value', $(this).attr('placeholder') )
  5. .focus(
  6. function(){
  7. var ph = $(this).attr('value');
  8. $(this).attr('value','').blur( function(){
  9. if($(this).attr('value').length < 1 ){
  10. $(this).attr('value', ph);
  11. }
  12. })
  13. });
  14. } );
  15.  
  16. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.