javascript - jQuery - Using arrow keys when navigating away from select options -
the below jquery using navigate through input elements on jqdialog booking docket. i've added class called move each element want navigate through.
one problem having when navigate away select alternative moves away on key downwards changes select alternative next value. there way disable this?
the other issue i'm having when going through move classes, doesn't appear in order expecting (it's not same order tab, shift + tab keys)
jquery
$(function (){ var keyup = 38; var keydown = 40; $(document).keydown( function(e) { var moves = $(".move"); // key function if (e.keycode == keydown) { for(i = 0; <= moves.length; i++) { if (moves[i] == $(".move:focus").get(0)) { $(moves[i + 1]).focus(); break; } } } if (e.keycode == keyup) { for(i = 0; <= moves.length; i++) { if (moves[i] == $(".move:focus").get(0)) { $(moves[i - 1]).focus(); break; } } } } ); }); select html example:
<select id="txt-payment" class="input-select move right" /> <option value="cash">cash</option> <option value="acc">acc</option> <option value="cc">cc</option> <option value="pp">pp</option> </select> any help much appreciated!
javascript jquery
No comments:
Post a Comment