Home  »  CodeGuidesLibrariesProgrammingSnippetsTechnology   »   How to Disable Keyboard Input in JavaScript

How to Disable Keyboard Input in JavaScript

Posted: October 3, 2022 | by Michael Bright

Use this to disable keyboard input in JavaScript:

$('#datepicker').keypress(function(event) {
   event.preventDefault();
   return false;
});

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.