I want to use the nifty new "placeholder" attribute in HTML5, but few browsers support it. The following uses progressive enhancement to support the feature in a cross-browser way.
Requirements:
I want to use the nifty new "placeholder" attribute in HTML5, but few browsers support it. The following uses progressive enhancement to support the feature in a cross-browser way.
Requirements:
jQuery(document).ready(function($) { | |
if (!Modernizr.input.placeholder) { | |
$('input[placeholder],textarea[placeholder]').each(function() { | |
$(this).example($(this).attr('placeholder')) | |
}); | |
} | |
}); |
input.example, textarea.example { | |
color: #909090; | |
} |