javascript - Keeping the tab focus inside a jQuery dialog -


i learning jquery dialog , use in side project. want add tabindex divs in dialog tabbing. focus goes elsewhere when tab on last element in dialog.

i want focus go first element when tab on last element. there way keep focus in dialog?

thanks!

add keypress event on last element ignore default tab action , put focus on first element in dialog.

the following example assumes last element last_element_id , first first_element_id.

$('#last_element_id').on('keydown', function(e) {     if ((e.keycode || e.which) == 9) {         $('#first_element_id').focus();             e.preventdefault();      }  }); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -