Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/diy/jquery-placeholder

A jQuery plugin that polyfills the HTML5 "placeholder" attribute.
https://github.com/diy/jquery-placeholder

Last synced: about 2 months ago
JSON representation

A jQuery plugin that polyfills the HTML5 "placeholder" attribute.

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
If true, 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.