Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/diy/jquery-placeholder
A jQuery plugin that polyfills the HTML5 "placeholder" attribute.
https://github.com/diy/jquery-placeholder
Last synced: 18 days ago
JSON representation
A jQuery plugin that polyfills the HTML5 "placeholder" attribute.
- Host: GitHub
- URL: https://github.com/diy/jquery-placeholder
- Owner: diy
- Created: 2012-05-23T18:00:19.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-12-03T02:26:00.000Z (almost 11 years ago)
- Last Synced: 2024-08-01T00:57:09.016Z (3 months ago)
- Language: JavaScript
- Homepage: http://diy.github.com/jquery-placeholder/
- Size: 190 KB
- Stars: 76
- Watchers: 33
- Forks: 41
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# .placeholder()
A basic jQuery (>= 1.7) plugin that reads the [**"placeholder"** attribute](http://www.w3.org/community/webed/wiki/HTML5_form_additions#placeholder) (HTML5) and renders the placeholder text as an overlay (if not natively supported). Unlike most other plugins, this works by adding a properly-positioned `` on top of the input element rather than setting its value. This keeps form serialization & validation from breaking.
```javascript
$('input[placeholder], textarea[placeholder]').placeholder();
```Check out the [demos](http://diy.github.com/jquery-placeholder/)!
### Options
Option
Type
Default
Description
force
bool
false
Iftrue
, artificial placeholder elements will be added even if the browser natively supports them.
### CSS Styling
```css
.placeholder { color: #d0d0d0; }
::-webkit-input-placeholder { color: #d0d0d0; }
input:-moz-placeholder, textarea:-moz-placeholder { color: #d0d0d0; }
```## License
Copyright © 2012 DIY Co
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.