79502986

Date: 2025-03-12 08:23:30
Score: 0.5
Natty:
Report link

Attach an event listener to the input element to prevent default behavior of certain keys in input element.

document.getElementById('input-element-id').addEventListener('keydown', function(e) {
   if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
      e.preventDefault();
   }
});
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: vicki