I am trying to test the tabbing on a page but I cannot SEE what I've just tabbed to.
I managed to highlight the input element types text and textarea pretty easily. Radio did not work, but affecting the parent element did work. Here's my jquery:
$(":input").focusin( function() {
if($(this).attr('type') === 'radio') {
$(this).parent().attr('style', 'background-color: yellow !important');
} else {
$(this).attr('style', 'background-color: yellow !important');
}
});
$(":input").focusout( function() {
if($(this).attr('type') === 'radio') {
$(this).parent().css('background-color','');
} else {
$(this).css('background-color','');
}
});
But now I still have some other elements that I'm tabbing to and I cannot even tell what they are. All I know is it takes several tab presses to get from the last radio group to the next "select" element (which I can see is focused even without extra jquery code). After that is a button, which I also would like to be highlighted.
Do I have to list conditions for every single element? Or use a selector like $(":input,:button,[etc]")
? Is there some easy way I can just have the element, whatever it is, highlighted after it is tabbed to?