ASP + Jquery从Gridview关注下一个文本框

我有一个表格的gridview。 在这张表中,我们有一些标签和文本框。

我正在尝试在用户按Enter键时从文本框切换到下一个文本框。 为此,我正在使用Jquery。

$(function () { var inputs = $(".mGrid").find('input:text'); inputs.each(function (index, element) { $(element).on('keyup', function (e) { e.preventDefault(); if (e.which === 13) { // alert("enter pressed"); if (index < inputs.length - 1) { var currentInput = inputs[index]; //currentInput.blur(); $(':text').blur(); var nextInput = inputs[index + 1]; alert($(nextInput)); $(nextInput).focus(); } else { $(inputs[0]).focus(); } } }); }); }); 

现在发生的是,它不会将带有文本的文本框集中在里面。 此外,当文本框为空时,您需要在输入之前单击两次垃圾邮件,然后才能从文本框实际切换。

ASP.net WebForms标记:

  
<asp:CheckBox ID="Lotnummers" runat="server" Enabled=False Checked=''>

在此处输入图像描述

我使用相同的Jquery创建了一个JSFiddle,它在那里工作。 我想ASP中的文本框一定有些东西吗?

https://jsfiddle.net/55j6L92k/2/

编辑:它适用于< input type="text" id="txtScanLotNr" style="background-color:#D8D8D8; border-style: none; " />

但没有

   

不幸的是我需要使用

这应该工作。 基本上你必须先找到下一个

,然后再找到它内的TextBox。

  

使用此GridView进行测试