Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amerikan/placeholder-polyfill
Add placeholders to your inputs and textareas in older browsers that don't support the placeholder attribute natively.
https://github.com/amerikan/placeholder-polyfill
jquery-plugin placeholder
Last synced: about 2 months ago
JSON representation
Add placeholders to your inputs and textareas in older browsers that don't support the placeholder attribute natively.
- Host: GitHub
- URL: https://github.com/amerikan/placeholder-polyfill
- Owner: amerikan
- Created: 2014-12-19T18:27:15.000Z (about 10 years ago)
- Default Branch: main
- Last Pushed: 2023-07-17T07:39:16.000Z (over 1 year ago)
- Last Synced: 2024-11-10T15:58:51.027Z (3 months ago)
- Topics: jquery-plugin, placeholder
- Language: HTML
- Homepage: https://amerikan.github.io/placeholder-polyfill/
- Size: 11.7 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
placeholder-polyfill
====================A small jQuery plugin to show placeholders on HTML ``'s and ``'s in browsers that don't support the `placeholder` attribute natively.
## Demo
[Live Demo](http://amerikan.github.io/placeholder-polyfill) - the plugin take effect in only browsers that don't support the placeholder attribute natively[Demo with forceMode option](http://amerikan.github.io/placeholder-polyfill/simulated.html) - the plugin will take effect in all browsers by force
## Requirements
Requires jQuery 1.0+
## Usage
First include the placeholder-polyfill plugin after your jQuery:
```html
```
Then initialize:
```html
$(function () {
$('input, textarea').placeholder();
});```
```html
```
The plugin will then look for any `` and `` in your page that has the `placeholder` attribute set and add the placeholder functionality if the browser doesn't support it already natively already. See [Can I Use](http://caniuse.com/#feat=input-placeholder) to see what browsers support placeholder natively.
You can also pass options:
```html$(function () {
$('input, textarea').placeholder({customClassName: 'my-placeholder'});
});```
### Options Available
`customClassName`: class name of wrapper. `default value: placeholder``forceMode`: force a browser to use the plugin functionality even if it supports placeholder natively. Please note, that in such case you will need to use **placeholder-x** as an attribute rather than **placeholder**. This is mostly useful for debugging modern browsers. `default value: false`
## Bugs
The development of this plugin just started so it's fairly new. I welcome Pull Requests and bug reports.
Before opening an issue, please check if a similar issue is not already opened. When opening an issue please include:
- browser(s) affected
- test case for me to test
- jQuery version## License
MIT