自動進入TAB鍵與字段下一頁輸入我有輸入的形式,其還具有嵌入在其中也有輸入(僞HTML)形式的iFrame:上輸入在iFrame中
<input type="text" name="one" value="one" />
<input type="text" name="two" value="two" />
<input type="text" name="three" value="three" />
<iframe
<input type="text" name="bacon" value="bacon">
</iframe>
<input type="text" name="four" value="four" />
<input type="text" name="five" value="five" />
當用戶他們從輸入採取標籤他們從輸入甚至輸入內部iframe字段選擇培根後三。我們都喜歡培根。
我也有一些JavaScript試圖下一個輸入重點回車鍵:
$(document).ready(function() {
$(document).on('keydown', 'input', function(ev) {
// Move to next on enter
if (ev.which === 13) {
var inputs = $(':tabbable');
var next = inputs.index(this) + 1;
var input = inputs.eq(next == inputs.length ? 0 : next);
input.focus();
return false;
}
});
});
的問題是JavaScript回車鍵代碼永遠不會聚焦臘肉領域,它會直接跳到了它。的jsfiddle:
https://jsfiddle.net/54n8mqkh/4/
讓我們包括不使用的iFrame都顧不上回答。我知道這不是一個理想的實現。然而,我會接受任何答案,允許輸入鍵一致地移動所有字段,包括使用任何類型的JavaScript的iframe。它不一定是jQuery特定的。
我已經嘗試了幾種不同的方法來解決這個問題,但沒有找到任何工作。提前感謝任何有解決方案的人。
此外,你可能不會在小提琴看到的是iframe的小提琴回調到父搗鼓導航無縫地工作,這意味着相同的起源政策 - 被警告。 – jriffel73