Return to Snippet

Revision: 13591
at April 28, 2009 17:59 by dougunderscorenelson


Initial Code
$("input, textarea", $("form")).focus(function(){
    $(this).addClass("focus");
    $(this).parents(".form-field").addClass("cur");
});
$("input, textarea", $("form")).blur(function(){
    $(this).removeClass("focus");
    $(this).parents(".form-field").removeClass("cur");
});

Initial URL

                                

Initial Description
This adds a class to focused form elements (helpful for IE6/7), as well as adds a class to the input's parent (in this case, named "form-field").

Initial Title
Adding a Focus class to Forms

Initial Tags
form, jquery

Initial Language
jQuery