https://github.com/matoilic/jquery.placeholder
jQuery-based polyfill for the HTML5 placeholder attribute, that also patches $.fn.val properly
https://github.com/matoilic/jquery.placeholder
Last synced: 2 months ago
JSON representation
jQuery-based polyfill for the HTML5 placeholder attribute, that also patches $.fn.val properly
- Host: GitHub
- URL: https://github.com/matoilic/jquery.placeholder
- Owner: matoilic
- Created: 2011-12-16T16:39:41.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2016-04-10T11:56:58.000Z (about 9 years ago)
- Last Synced: 2025-03-23T06:24:04.464Z (3 months ago)
- Language: JavaScript
- Homepage: http://matoilic.github.io/jquery.placeholder/
- Size: 69.3 KB
- Stars: 22
- Watchers: 6
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jquery.placeholder #
jquery.placeholder is a small [jQuery](http://jquery.com)-based pollyfill for the HTML5 placeholder attribute.
## Usage ##
Just include the script and it takes care of everything. It also patches jQuery's `$.fn.val` function to return an empty value if the actual value matches the placeholder. If you add form fields dynamically to your form just call the `placeholder` function on your element, e.g. `$('input').placeholder()`, to initialize the plugin. The script adds a `placeholder` class to each element that contains a placeholder so you can style it properly.
`$.placeholder.input` and `$.placeholder.textarea` inidcate if the browser has native placeholder support for the two elements.
Demo: http://matoilic.github.com/jquery.placeholder
## Browser support ##
It supports all browsers that do not have native support for the placeholder attribute. Or at least I have not found one where it does not work :).
## Version History ##
**0.1**
* initial release
**0.1.1**
* define an empty `$.fn.placeholder` function if native browser support is available
**0.2**
* improved handling of password fields
**0.2.1**
* it doesn't drop and recreate password fields so that long time references don't break
**0.2.2**
* fixes IE6 support
* `$.placeholder.input` and `$.placeholder.textarea` to inidcate if the browser has native placeholder support for the two elements**0.2.3**
* fixes `$.placeholder.input` and `$.placeholder.textarea`
**0.2.4**
* jQuery 1.9 compatibility
## Licence ##
Copyright © 2016 Mato Ilic <>
jquery.placeholder is dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html