tags:

views:

122

answers:

2

Like the youtube embed text fields. How do you make a text field selectable but not changeable?

+8  A: 
<input type="text" value="Some Text" readonly="readonly" />
Dustin Laine
Don't know how I missed that when analyzing the html of youtube. I thought it was somekind of js-solution, but apparently they use this technique too. Very simple. Thanks!
quano
Simple is best!
Dustin Laine
+1  A: 

Another way to achieve this is just to make a div appear like a text field.

<div style="border: inset 2px #ccc;background:#fff;padding:2px;">
  http://example.com/?id=sdfsdfsdfsdfsdf
</div>
jessegavin