Home > Software design >  HTML - I cannot copy the value from a read-only input type
HTML - I cannot copy the value from a read-only input type

Time:03-29

I have an input set to read-only

<input type="text" placeholder="{some variable}"  readonly>

When I open this in chrome, I cannot copy the text, which is important. I have tried also 'disabled' status, but the same issue.

What is the way to set the code so I can copy the value from the browser?

Big thanks!

CodePudding user response:

You need to set the value of that input-field instead of the placeholder:

<input type="text" value="{some variable}"  readonly>
  • Related