鍍金池/ 問(wèn)答/HTML5  HTML/ 在jq事件中,下一個(gè)dom獲取焦點(diǎn)

在jq事件中,下一個(gè)dom獲取焦點(diǎn)

$lastGoodsgrid.on("keydown",
                "[colname='F_GoodsName'] > input",
                function(e) {
                        if (e.keyCode == 13) {
                            //我想讓下一個(gè)input獲取焦點(diǎn),請(qǐng)問(wèn)怎么操作?
                        }        
                }

多個(gè)input,如何讓下一個(gè)input獲取焦點(diǎn)?怎么獲取下一個(gè)input對(duì)象?謝謝大家

回答
編輯回答
懷中人

$(this).next().val(); --針對(duì)input標(biāo)簽,獲取值

$(this).next().text(); --針對(duì)span或者textarea標(biāo)簽,獲取值

2018年5月1日 18:36
編輯回答
孤客

13 是回車(chē),回車(chē)的默認(rèn)操作應(yīng)該是提交表單而不是跳轉(zhuǎn)到下一項(xiàng)。跳轉(zhuǎn)到下一項(xiàng)應(yīng)該按 Tab 鍵,有標(biāo)準(zhǔn)行為,用 tabindex 控制,不要亂來(lái)。

2017年10月17日 20:40
編輯回答
乖乖瀦
2017年1月31日 17:02
編輯回答
尐懶貓

$(this).next().focus()

2017年3月3日 15:45