Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如果在我移动到下一项时输入被禁用_Javascript_Jquery_Html - Fatal编程技术网

Javascript 如果在我移动到下一项时输入被禁用

Javascript 如果在我移动到下一项时输入被禁用,javascript,jquery,html,Javascript,Jquery,Html,如果使用下一个函数禁用元素#3,如何从元素#2移动到元素#4 jQuery.extend(jQuery.expr[':'], { focusable: function (el, index, selector) { return $(el).is('[tabindexgt],[tabindexdxfiltro]'); } }); $(document).on('keypress','input,select', function (e) { if (

如果使用下一个函数禁用元素#3,如何从元素#2移动到元素#4

jQuery.extend(jQuery.expr[':'], {
    focusable: function (el, index, selector) {
        return $(el).is('[tabindexgt],[tabindexdxfiltro]');
    } 
});

$(document).on('keypress','input,select', function (e) {
    if (e.which == 13) {
        e.preventDefault();
        // Get all focusable elements on the page
        var $canfocus = $(':focusable');
        var index = $canfocus.index(document.activeElement) + 1;
        if (index >= $canfocus.length) index = 0;
        $canfocus.eq(index).focus();
    }
});
使用选择器并尝试更改:

var $canfocus = $(':focusable');

var $canfocus = $(':focusable').not(':disabled');