javascript - Checkbox to button focus -


i've got multiple forms on page. in 1 form i've got 3 text fields check box , button. when tab key pressed, goes 3 text fields , checkbox , no where.

how can focus button (submit) after checkbox (maths) , first text field (user_id).

<form id="form13"> user id :<input type="text" id="user_id" /><br> password:  <input type="password" id="password" /><br> department:  <input type="text" id="department" /><br> <input type="checkbox" id="maths" value="on"> maths <input type="submit" id="submit" value="submit" /> </form>       $('#maths').keydown(function(e){         if (e.which  == 9){             $('#submit).focus();         }       }); 

if need handle tabbing in html forms. may need handle html attribute tabindex article learning purpose:

<input id="foo" tabindex="1"  /> <input id="bar" tabindex="3"  /> <input id="awesome" tabindex="2"  /> 

so, can handle in way. , yes, can change dynamically using javascript:

document.getelementbyid("foo").tabindex = "3"; 

i hope may you.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -