我需要让按钮在按下键盘按钮时进入.active状态,而不是单击时按钮.
这是我的代码...提前谢谢.
脚本:
$(document).on('keypress', function (e) {
var tag = e.target.tagName.toLowerCase();
if (e.which === 119 && tag != 'input' && tag != 'textarea')
$('#forward').click();
if (e.which === 115 && tag != 'input' && tag != 'textarea')
$('#back').click();
if (e.which === 97 && tag != 'input' && tag != 'textarea')
$('#left').click();
if (e.which === 100 && tag != 'input' && tag != 'textarea')
$('#right').click();
});
$(function () {
$("#forward").click(function () {
$.ajax('/forward');
});
$("#back").click(function () {
$.ajax('/back');
});
$("#left").click(function () { …Run Code Online (Sandbox Code Playgroud) 我在我的Raspberry pi上运行了Node js.当我运行$ node -v时它给我版本号,但是当我运行$ sudo node -v它返回node:not found
我需要以root身份运行它,任何想法?