﻿$.fn.clearOnFocus = function () {

    /* No attribution required,
    don't use excessively */

    return this.focus(function () {
        var v = $(this).val();
        if (v === this.defaultValue)
            $(this).val('');        
    }).blur(function () {
        var v = $(this).val();
        $(this).val(v.match(/^\s+$|^$/) ? this.defaultValue : v);
    });

};
