Change CSS Class on Focus
Hello,
I have a form where each field is inside a div.
So I have the following code to highlight the div on mouse over and remove it on mouse out:
- $('form div.Field').hover(function () {
- $(this).addClass('Hover');
- }, function () {
- $(this).removeClass('Hover');
- });
But what I really need is:
- Add CssClass Hover when any form element (input, select, ...) inside the div is focus;
- Remove CssClass Hover when the form elements inside the div stop being on focus.
Do you understand?
How can I do this?
Thanks,
Miguel