jQuery Highlight related label when input in focus

Another way to make your form easier to fill for your visitors: Highlight related label when input in focus. Here’s some jQuery goodness to help.
[javascript]
$("form :input").focus(function() {
$("label[for=’" + this.id + "’]").addClass("labelfocus");
}).blur(function() {
$("label").removeClass("labelfocus");
});
[/javascript]

Leave a Reply