0

Hello, everyone.

I have a scrollbox that I am needing to select all of the text within it. The code is below.

<div class="all" style="height:480px;width:360px;border:1px solid #ccc;font:16px/26px Georgia, Garamond, Serif;overflow:auto;">

This part of web programming is my weak point. I'm not quite sure what else to try.

If you have any suggestions, I'd be grateful to hear them.

Thanks for reading this,

Resentful

2
Contributors
4
Replies
5
Views
4 Years
Discussion Span
Last Post by Resentful
1

we can achieve this by using "contenteditable" property and the following java script code

<div contenteditable="true" onclick="document.execCommand('selectAll',false,null)">

Place  your text here 

</div>

you can add your styles to this div as usual

let me know if you have any problem

Votes + Comments
Awesome solution!
0

Much appreciated. Worked perfectly. Is there a way to make a button also select this? If not, that's fine.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.