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

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

commented: Awesome solution! +1

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

i think there is no way to do like that ( w.r.t div's point of view)

and i got your solution from here

http://help.dottoro.com/ljcvtcaw.php

please refer this site for more code about the requirement if possible

Thanks for all the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.