Thursday, May 23, 2024
 Popular · Latest · Hot · Upcoming
116
rated 0 times [  120] [ 4]  / answers: 1 / hits: 43958  / 12 Years ago, sat, april 21, 2012, 12:00:00

I am searching for a possibility to disable all keyboard keys in a textarea. I found some examples on the web to disable some single ones but how can I disable the whole keyboard??


More From » javascript

 Answers
57

You can disable the textarea using the disabled attribute. Or you can make it read only using the readonly attribute. readonly is like disabled except it doesn't prevent the user from clicking or selecting in the textarea.



And if you really need to do it with javascript something like this will do it (using jQuery):



<textarea rows=3 cols=20></textarea>​

$(textarea).keydown(false);


You can try it here: http://jsfiddle.net/7n4G4/1/


[#86087] Friday, April 20, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
anyssaarielles

Total Points: 415
Total Questions: 107
Total Answers: 92

Location: Greenland
Member since Fri, Jul 31, 2020
4 Years ago
;