Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
The modest Javascript placeholder
JavaScript
Tree: 90ca6856fb

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
releases
src
test Released v0.8.6
CHANGELOG
MIT-LICENSE
README.textile
Rakefile
VERSION

README.textile

SeatHolder

The modest Javascript placeholder

Introduction

SeatHolder is a small Javascript library which lets you display placeholder text (so called seatholders) and place default values to text inputs and textareas with great ease. It uses jQuery (http://jquery.com) to keep your HTML as clean as possible.

Installation

When including jQuery yourself

Just include SeatHolder after you have included jQuery:

  <script src="path/to/jquery.js" type="text/javascript"></script>
  <script src="path/to/seat_holder.js" type="text/javascript"></script>

Note: include seat_holder-min.js for the minified SeatHolder library

When letting SeatHolder include jQuery automatically

Make sure you put the jquery directory in the same directory as the SeatHolder library:

  |
  |-- seat_holder.js
  |
  |-- jquery
    |
    |-- core.js

Just include SeatHolder:

  <script src="path/to/seat_holder.js" type="text/javascript"></script>

Note: include seat_holder-min.js for the minified SeatHolder library

Usage

Placeholders

Just add the seatholder attribute to your inputs:

  <form>
    ...
    <input type="text" name="user[first_name]" seatholder="Your first name">
    <textarea name="question[body]" seatholder="Please specify your question"></textarea>
    ...
  </form>

Default values

As stated above, you can also specify default values for text inputs and textareas. Just start the seatholder attribute with '&':

  <form>
    ...
    <input type="text" name="object[title]" seatholder="&SeatHolder Demo">
    <textarea name="object[body]" seatholder="&I would like to receive more information"></textarea>
    ...
  </form>

For a complete live demo, please visit http://codehero.es/demos/seat_holder and http://gettopup.com/demo.

SeatHolder.react()

You can tell SeatHolder whether to react on focus events of hinted elements are not and it does at default of course. Just call SeatHolder.react(bool) in which bool can be left undefined (it will be assumed as true) or can be a boolean (SeatHolder will not react on focus events when false).

Contact me

For support, remarks and requests please mail me at paul.engel@holder.nl.

Credit

This Javascript library depends on:

jQuery
http://jquery.com

ToDo’s

None

License

Copyright © 2010 Paul Engel, released under the MIT license

http://holder.nlhttp://codehero.eshttp://gettopup.comhttp://twitter.com/archan937paul.engel@holder.nl

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.