If you’re wondering how to support the HTML5 placeholder attribute for inputs and textareas, here’s a simple solution using Modernizr and a jQuery Placeholder plugin by Mathias Bynens (also used in Zurb’s Foundation). First we detect browser support and apply the placeholder plugin if it’s available, with an ‘ol fashion HTML label as fallback.

if( !Modernizr.input.placeholder ) {
	// Browser does not support input placeholder attribute
	if( $.fn.placeholder ) {
		// The plugin exists, use it!
		$('input, textarea').placeholder();
	} else {
		// Browser doesn't support placeholders and the placeholder plugin isn't loaded
		// What shall we do, show hidden labels perhaps? Maybe something like:
		// <label class="placeholder-fallback hidden" for="fieldID">Field Description</label>
		// $('label.placeholder-fallback').show();