8

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

2 Answers 2

28
<input type="text" value="Some Text" readonly="readonly" />
Sign up to request clarification or add additional context in comments.

1 Comment

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!
1

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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.