could someone help me on this code? when i click right arrowkey on checkbox2, focus should move to submit button.and when i clic
<html><body> <div> <input type="checkbox" id="mycheckbox" autofocus>1</input> <input type="checkbox" id="mycheckbox"/>2 </div> <div> <input type="button" value="submit"></input> <input type="button" value="reset"></input> </div> <script src="http://code.jquery.com/jquery-1.11.2.min.js"></script> <script> $(document).ready(function () { $('input').keydown(function (event) { var keycode = (event.keyCode ? event.keyCode : event.which); if (keycode == 13) { clickCheckBox(this); } if (keycode == 39) { if($(this).nextAll('input').length === 0) { $('input:enabled:first').focus(); } else { $(this).next('input').focus(); } } if (keycode ==37) { if($(this).prevAll('input').length === 0) { $('input:enabled:last').focus(); } else $(this).prev('input').focus(); } event.stopPropagation(); }); }); function clickCheckBox(box) { var $box = $(box); $box.prop('checked',!$box.prop('checked')); } </script> </body></html>