Created
March 13, 2010 15:41
-
-
Save jonobr1/331376 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jquery.formUI by Jono Brandel | |
http://jonobr1.com/ | |
This is an all purpose javascript file | |
to increase the usability for forms. | |
Dependent on jQuery. | |
http://jquery.com/ | |
--------------------------------------------*/ | |
$(function(){ | |
var inputObject = $('input[type="text"]'); | |
$.each(inputObject, function(i) { | |
var t = $(this).val(); | |
$(this).focus(function(e) { | |
var either = $(this).val(); | |
if( either == t) { | |
$(this).val(''); | |
} | |
}).blur(function() { | |
var whether = $(this).val(); | |
if(!whether) { | |
$(this).val(t); | |
} | |
}); | |
}); | |
var textareaObject = $('textarea'); | |
$.each(textareaObject, function(i) { | |
var t = $(this).val(); | |
$(this).autogrow(); | |
$(this).focus(function(e) { | |
var either = $(this).val(); | |
if( either == t) { | |
$(this).val(''); | |
} | |
}).blur(function() { | |
var whether = $(this).val(); | |
if(!whether) { | |
$(this).val(t); | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment