+ 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

26th Jun 2018, 11:15 AM
Satish Kumar Sharma
Satish Kumar Sharma - avatar
7 Respostas
+ 2
Try to use, event.preventDefault(); return false; to disable key input entry
26th Jun 2018, 2:03 PM
Calviղ
Calviղ - avatar
+ 1
You should set if(mob.value.length > 10)
26th Jun 2018, 12:22 PM
Calviղ
Calviղ - avatar
0
I want to know the javascript code that can disable the keyboard.
26th Jun 2018, 1:14 PM
Satish Kumar Sharma
Satish Kumar Sharma - avatar
0
thank you
26th Jun 2018, 2:19 PM
Satish Kumar Sharma
Satish Kumar Sharma - avatar
0
if I wish to prevent all keys except backspace key. How can do it.
26th Jun 2018, 2:21 PM
Satish Kumar Sharma
Satish Kumar Sharma - avatar
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
26th Jun 2018, 2:25 PM
Calviղ
Calviղ - avatar
0
line number 63 to 70 does not work when I add if condition (63).
26th Jun 2018, 5:21 PM
Satish Kumar Sharma
Satish Kumar Sharma - avatar