I want to disable TAB & ENTER key. I can do it in separate script like below:
<script>
document.addEventListener('keydown', function (e) {
if (e.keyCode === 13) {
e.preventDefault();
e.stopPropagation();}
});
</script>
<script>
document.addEventListener('keydown', function (e) {
if (e.keyCode === 9) {
e.preventDefault();
e.stopPropagation();}
});
</script>
How to combine it become just 1 script?
Use Logical Operator
OR ||
operator which will check for both conditions as below