如果有人可以帮助我在这里修改单选按钮的现有行为,如下所示。
我们需要这个以便于访问。
TAB> Moves to the next radio button group within the same row or the next row.
Up> Moves to the previous radio button within the current group if available.
Down> Moves to the next radio button within the current group if available.
Left> Moves to the previous radio button within the current group if available.
Right> Moves to the next radio button within the current group if available.
答案 0 :(得分:0)
您可以访问键盘的关键事件。
$('input[type="radio"]').keydown(function(e)
{
var arrowKeys = [37, 38, 39, 40];
if (arrowKeys.indexOf(e.which) !== -1)
{
if (e.which == 38)
{
//jquery code to move right or left
// set the element you want to focus on
}
else if (e.which == 40)
{
//jquery code to move top or down
// set the element you want to focus on
}
return false;
}
});