Skip to content

HTML5 uses placeholder attribute of form fields to display watermarks inside form fields. This is a jQuery plugin to use with Modernizr to polyfill html5 placeholder attr.

Notifications You must be signed in to change notification settings

ozexpert/html5-polyfill-placeholder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HTML 5 polyfill for placholder attribute

This is a jQuery plugin to use with Modernizr for older browsers to behave HTML 5 placeholder attribute. Must be used with Modernizr to test placeholder attribute, but it doesn't do any harm if checking for placeholder attribute is not there :-).

HTML 5 placholder attribute generates nicely embedded watermark effect to your form fields like input, or textarea. Only the latest browsers supports this effect, but using placeholder.js plugin with Modernizr will make similar effect for the older browsers.

Example usage in js

if(!Modernizr.placeholder){
    $("form").placeholder();
}

Options

There are two CSS attributes you can use. By default, font-style will be italic and color will be #ccc. However, to override those options, you could do the following.

$("form").placeholder({'font-style':'normal', 'color':'#f2f2f2'});

License

MIT license

About

HTML5 uses placeholder attribute of form fields to display watermarks inside form fields. This is a jQuery plugin to use with Modernizr to polyfill html5 placeholder attr.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published