Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/whawker/jquery-placeholder
jQuery placeholder plugin, with support for password fields and modified $.fn.val
https://github.com/whawker/jquery-placeholder
Last synced: 11 days ago
JSON representation
jQuery placeholder plugin, with support for password fields and modified $.fn.val
- Host: GitHub
- URL: https://github.com/whawker/jquery-placeholder
- Owner: whawker
- Created: 2014-05-20T16:33:28.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-05-20T17:35:56.000Z (over 10 years ago)
- Last Synced: 2024-10-11T18:31:39.939Z (about 1 month ago)
- Language: JavaScript
- Size: 168 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
(Another) jQuery Placeholder
==================jQuery placeholder polyfill plugin with a few handy features
## Usage
```
$('[placeholder]').placeholder();
```For best results, use with [HTML conditional classes](http://www.paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/)
```
$('html.lte9 [placeholder]').placeholder();
```## Support for password fields
Creates a text input field and hides original password field, so placeholders are displayed correctly rather than ••••••When text input is received to the dummy password field, input is passed back to the original password field, so information is hidden.
When the form is submitted, the dummy password fields are removed.
## Blanking placeholder fields on submit
Any field that still holds the placeholder value on submit, will be blanked before the submit occurs. Ensuring placeholder values are not submitted to the back end.You can disable this functionality using
```
$('form').off('submit', $.fn.placeholder.blankOnSubmit);
```## Modified $.fn.val function
This plugin modifies the default jQuery val() function, so attempting to retrieve the value of an input field in any other plugin/code will not retrieve the placeholder text. If the value is equal to the placeholder text, empty string is returned.## Emulated Firefox/Chrome focus functionality
Placeholder is displayed, until text input is recieved. Rather than blanking the input on focus.