jquery - switching anchor tags on popover with a tab key -


i have popover message in webapplication. want perform action. has 2 buttons/anchor tags.

when show popover, first button in focus (i'm setting focus jquery.focus) now, when press tab focus shifts second button, , after when hit tab focus goes in page ( below popover ). how make sure when keep pressing tab focus shifts between 2 buttons ( or n number of buttons , loop back) in popover , not go page.

try binding tab keydown, focus whichever button isn't focused.

$("body").keypress(function(e) {     var code = (e.keycode ? e.keycode : e.which);      if(code == 9){         if($("#button_one").focus()){             $("#button_two").focus();         }         else if($("#button_two").focus()){             $("#button_one").focus();         }     } }); 

source


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -