Move Cursor to next text Field pressing Enter

前端 未结 5 1298
半阙折子戏
半阙折子戏 2020-12-24 09:30

I have multiple text fields in my form and I want when user enters data in one text field and press enter that the cursor moves to another text-field which is next to curren

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-24 10:04

      **This code was perfectly worked in  cursor move to next contenteditable td and textboxes and dropdown list within td ,and datepicker within textbox by reference in class strong text**
    
        `var $input = $('.EnterlikeTab');
            $input.bind('keydown', function (e) {
                if (e.which == 13) {
                    e.preventDefault();
                    var nxtIdex = $input.index(this) + 1;
                    $(".EnterlikeTab:eq(" + nxtIdex + ")").focus();
                }
            });` 
    

提交回复
热议问题