Created
September 16, 2012 01:15
-
-
Save gMagicScott/3730669 to your computer and use it in GitHub Desktop.
jQuery to highlight (add css class) table row for form fields on focus
This file contains 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
$(document).ready(function () { | |
$("input,select,textarea").focus(function() { | |
$(this).closest("tr").addClass("curFocus") | |
}); | |
$("input,select,textarea").blur(function() { | |
$(this).closest("tr").removeClass("curFocus") | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Remember:
If you are going to use this inline within the document even though it's a bad idea, add the extra CDATA tags.
And as noted in the title and comment, this requires jQuery to be loaded first.