- How do I make a select option read only?
- How can I disable an option in a select based on its value in Javascript?
- How to get disabled select box value in PHP?
How do I make a select option read only?
According to HTML specs, the select tag in HTML doesn't have a readonly attribute, only a disabled attribute. So if you want to keep the user from changing the dropdown, you have to use disabled .
How can I disable an option in a select based on its value in Javascript?
You can use querySelectorAll, and forEach off of the resulting NodeList to do this same thing more easily in 2022.
How to get disabled select box value in PHP?
Originally Answered: How I can post the value of a disabled input field to database in PHP? Use the 'readonly' attribute, rather than 'disabled'. Then set the 'value' attribute. That's it; it will be available to $_POST and you can then process it like any other input.