开发者

Disabled Scrollable Textarea

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜