Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/xwartz/placeholder

HTML5 features support in older browser
https://github.com/xwartz/placeholder

Last synced: about 1 month ago
JSON representation

HTML5 features support in older browser

Awesome Lists containing this project

README

        

Placeholder
===========

## HTML5 Placeholder Feature Like `Chrome` support in older browser

### Example Usage

Use the plugin as follows:

#### JS

```js
$('input').placeholder();
```

#### CSS

The plugin automatically adds `class="placeholder"` to the placeholder text and adds `class="placeholder-wrapper" to the element parent who created by plugin`.
You should set css style make it work, like:

```css
.placeholder-wrapper {
position: relative;
display: inline-block;
}
.placeholder {
position: absolute;
left: 0;
top: 0;
padding: 7px, 4px;
color: #aaa;
cursor: text;
}
```

I’d suggest sticking to the `#aaa` color for placeholder text, as it’s the default in most browsers that support `@placeholder`.
If you really want to, though, you can [style the placeholder text in some of the browsers that natively support it](http://stackoverflow.com/questions/2610497/change-an-inputs-html5-placeholder-color-with-css/2610741#2610741).

### Notes

if you use `` element, you should set `id`, like
```html

```

The `` who the plugin created will always point to the `` element, and the `` element will focus when you click.

### License

This plugin is available under [the MIT license].