Skip to content

Instantly share code, notes, and snippets.

@rmanalan rmanalan/gist:46340
Created Jan 13, 2009

What would you like to do?
jQuery plugin for the "input prompt" pattern
// Extracted from
// Accepts JQuery elem as input for hiding/unhiding related elements.
$.fn.defaultValueActsAsHint = function(elems){
this.get(0)._default = this.attr('title');
return $(this).focus(function(){
if(this._default != this.value) return;
this.value = '';
if(this.value.trim() != '') return;
this.value = this._default;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.