views:

21

answers:

1

The select() method only seems to work with textareas and input spaces, and I don't know javascript very well, so I'm not coming up with any solutions. Does anyone know how to highlight everything in a pre box when you click on it?

What I'm trying to do is make it so a visitor can easily highlight everything in the pre so they can then copy and paste it. I am currently using textareas, and switching to pres mean that the user can no longer give it focus, so they can't do control a.

+1  A: 

Simply put, this is not possible. A workaround could be to create a <textarea readonly="readonly"> and style it like a <pre> block.

kb
Okay, I'll try that. Thanks!
Frisby