开发者

Disabled Scrollable Textarea

开发者 https://www.devze.com 2023-01-21 16:39 出处:网络
How can I create a scrollable text area which is disabled?By this I mean, I would like the user to be able to scroll to see the 开发者_如何学Gocontents of the text area but not be able to edit it.I th

How can I create a scrollable text area which is disabled? By this I mean, I would like the user to be able to scroll to see the 开发者_如何学Gocontents of the text area but not be able to edit it.


I think you need to know the readonly property.

<textarea readonly>blabla<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/></textarea>

Try here : link


Why use a <textarea> if user can't edit it ?

A simple <div> would do the trick with fixed height and overflow:auto;


<textarea readonly="true"></textarea>

just use readonly property

Update:

<textarea readonly>Some text</textarea>


the easiest way would be to use "readonly" instead.

another way would be to use a fixed-height div will overflow:scroll that looks like a textarea but isn't.

0

精彩评论

暂无评论...
验证码 换一张
取 消