html form question

Out of context: Reply #4

  • Started
  • Last post
  • 22 Responses
  • rabbit0

    (function( $, window, document, undefined ){

    //$(document).ready(function() {

    //clears all form values on focus
    $.fn.cleardefault = function() {
    return this.live("focus", function() {
    if( this.value == this.defaultValue ) {
    this.value = "";
    }
    }).live("blur", function() {
    if( !this.value.length ) {
    this.value = this.defaultValue;
    }
    });
    };
    $(".clearit input, .clearit textarea").cleardefault();

    //alert("test");
    //});

    })( jQuery, window, document );

    • add the class .clearit to an input or a textarea field for this to workrabbit
    • you need jqueryrabbit
    • let me know if you need any more help manrabbit

View thread