javascript - Creating variable array for keycode -
i trying create single variable contains of function key codes. if remove brackets , use single keycode works.
$('input').keyup(function (e) { var functionkeyspressed = e.which == [114, 115, 116, etc]; if (!functionkeyspressed) { } });
use indexof()
$('input').keyup(function (e) { var functionkeyspressed = [114, 115, 116, etc].indexof(e.which) > -1; if (!functionkeyspressed) { } });
Comments
Post a Comment