Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
simple input hint plugin
$.fn.hint = function(hint){
var val = $(this).eq(0).bind('focus', function(){
if($(this).val() == hint) $(this).val('');
}).bind('blur', function(){
if($(this).val() == '') $(this).addClass('hinting').val(hint);
}).bind('change', function(){
if(! /\S/.test(val)) $(this).eq(0).val(hint).addClass('hinting');
return this;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment