Posted By

athanassiadis on 03/25/11


Tagged

javascript js textmate placeholder modernizr


Versions (?)

Modernizr Placeholder


 / Published in: Other
 

  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  

You need to login to post a comment.