/ Published in: jQuery
Assumed support detection: Modernizr otherwise use some other
Expand |
Embed | Plain Text
/** * Augment placeholder functionality for inputs */ if(!Modernizr.input.placeholder){ $('input[placeholder]').each(function(){ var el = $(this) , placeholder = el.attr('placeholder') ; el.bind({ focus: function() { var el = $(this); if($.trim(el.val())==placeholder) el.val(''); } , blur: function() { var el = $(this); if($.trim(el.val())=='') el.val(placeholder); } }); if($.trim(el.val())=='') el.val(placeholder); }); }
You need to login to post a comment.
