Cross-Browser HTML5 Placeholder Text

Use Modernizr to detect if placeholder is supported, or else use jQuery to display the fallback placeholder text dynamically

One of the nice enhancement in HTML5 web form is being able to add placeholder text to input fields. Placeholder attribute allows you to display text in a form input when it is empty and when it is not focused (it clears the field on focus). This is a nifty feature, but it is not supported by all browsers yet. This tutorial will show you how to use Modernizr to detect if placeholder is supported, or else use jQuery to display the fallback placeholder text dynamically.


Comments

Be the first to write a comment

You must me logged in to write a comment.