So I want the features of a contenteditable div (text selection via keyboard being the main one), but I don't want to allow the user to edit the text - I presumed a readonly="readonly"
would work, but sadly it doesn't.
Do we know if there's a way to do it? The contenteditable div may have nested tags inside (<p>
's, <h1>
's).
I want to avoid a textarea (that's what this is for), as it doesn't allow me to do other things I need to be able to do.
Is there a nice way to do this without javascript? And if there isn't, is there a small snippet of javascript that will still allow copying, highlighting etc?
Thanks.
Here's an example: http://codepen.io/anon/pen/dxeAE