+ 1
Block textarea
Hi every body please how I Can Prevent Entry in a Textarea on HTML and CSS ?
6 Answers
+ 2
thanks
+ 2
#Peshkawt Mahmood wrote: << but its better to use javascript to prevent editing >>
Why do do you think it's better? @@
+ 2
how to do it with JS?
+ 2
With JS you can simply do:
<textarea oninput="this.value='';"></textarea>
... but it's not a good idea: the 'readonly' boolean attribute is well suited for that purpose, and in case of no JS allowed in browser (not available or desactivated by user) the expected behaviour will be lost ;P
If for some reasons the 'readonly' attribute don't give your expected behaviour, try to implement it in pure Html/Css rather than with JS:
https://code.sololearn.com/WjK5ZU6GQ3b0/?ref=app
(the code sample use an <input> but the Html/Css workaround could be adapted to a <textarea> element)
0
you can add readonly property in html
<textarea id="mytext" readonly></textarea>
but its better to use javascript to prevent editing
0
Blocked Textarea Code :
<textarea style=""rows=""disabled>Texts</textarea>