I need to add a css class to elements focused by tab key. I'm able to do this with focusin and focusout events using jquery.
But I don't need to add the class when focus using mouse click. How can I achieve this? Below is my code
$('#main-nav').focusin(
function () {
$(this).find('.submenu').addClass('focused');
}
);
$('#main-nav').focusout(
function () {
$(this).find('.submenu').removeClass('focused');
}
);
Thank you in advance...