spPlaceholder

HTML5 placeholder input text Javascript Plugin

A little Prototype plugin which enables cross-browser support for HTML5 placeholder attribute in inputs and textareas for browsers that aren't trying hard enough yet: you can download the source code here.

Try the Demo in old browsers
 

Usage

// JAVASCRIPT
<script type="text/javascript">
document.observe('dom:loaded', function () {
  var testplaceholder = new spPlaceholder('test');
});
</script>

// HTML
<form action="send.php" method="post" id="test">
  <fieldset>
    <legend>Try the Demo</legend>              
    <input type="text" name="name" placeholder="Please enter your name" />
    <textarea name="message" rows="5" cols="20" placeholder="Write a message"></textarea>
    <input type="submit" value="Send" class="button" />
  </fieldset>
</form>

Download

Get spPlaceholder.js (23/01/2011) licensed under the MIT license.