How to add “readonly” to an HTML input field using jQuery

jQuery <1.9

jQuery 1.9+

Read more about the differences between prop and attr.

Was this blog post helpful for you?

Support my blog and donate!

My blog is open to the public and will always be freely available. With your donation, we can help others learn, together.

Donate in Bitcoin: