+ 1
I wish take input only 10 letters.
if user input more than 10 letters then keys of keyboard become disable except delete key. https://code.sololearn.com/Wzqaq81Z5ulS/?ref=app
7 Respostas
+ 2
Try to use,
event.preventDefault();
return false;
to disable key input entry
+ 1
You should set
if(mob.value.length > 10)
0
I want to know the javascript code that can disable the keyboard.
0
thank you
0
if I wish to prevent all keys except backspace key. How can do it.
0
Try this
var key = event.key;
if (key === "Delete") { return false; }
More info please check out:
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
0
line number 63 to 70 does not work when I add if condition (63).