I have 2 div's on a page that I want the user to be able to move around with the arrow keys. I tried differentiating them by using focus but too many items(like inputs) can get focus. Currently when I click the div's I am applying a "focused" css style with a dotted line to make it stand out and removing the style from the other div.
.focused{
border: 1px dashed #cccccc;
}
$('#tagCommon').click(function(){
$(this).focus().addClass("focus2");
$('#tagLatin').removeClass("focus2");
});
I think this will work to intercept the key up events.
So how can I move just the object that has the class of focus2? Something like:
$(document).keydown(function(e) {
switch (e.which) {
case 37:
$('only the div that has class focus2').stop().animate({
left: '-= 10'
}); //left arrow key
break;
}
});
Thank you very much for bailing me out yet again, Todd