Published on Tuesday, September 13, 2011 by Jason in jQuery
This code allows you to easily set the focus and blur CSS class on form elements using jQuery.
// Set focus and blur CSS class for the following fields and field types
$("input, textarea, select").addClass("idle");
$("input, textarea, select").focus(function(){
$(this).addClass("activeField").removeClass("idle");
}).blur(function(){
$(this).removeClass("activeField").addClass("idle");
});