I have a jsp page, i want to implement up-down-left-right key functionality into page. i have following code but it visits the readonly text box as well. i want to skip that readonly inputs. Please check attached snap. I have A,B,C,D,E,F,G,H inputs but E and F are the readonly. My cursor is on C. suppose if i press down key (code=40) then it should go to G by skipping E and F.Same with other as well. Please check this link for image:
https://www.dropbox.com/s/ptm483avp8pm9sg/Untitled.png?dl=0
$(document).ready(function(){
$("input,textarea").keydown(function(e) {
if (e.keyCode==37 || e.keyCode==38 ) {
$(":input,textarea,select")[$(":input,select").index(document.activeElement) - 1].focus();
}
if (e.keyCode==39 || e.keyCode==40 ) {
$(":input,textarea,select")[$(":input,select").index(document.activeElement) + 1 ].focus();
}
});
});