By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
463,114 Members | 782 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 463,114 IT Pros & Developers. It's quick & easy.

how can I make a dropdownlist control readonly using javascript?

P: 1
Is there any way to set a DROPDOWN list to READONLY using jQuery or straight javascript? The objective is to NOT let a user change the previously selected value of dropdown list.
Jul 9 '14 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 8,639
I can think of several ways:

you could disable/remove all options except for the selected one.

you could disable the dropdown itself (if you need the value anywhere else either save it in a variable (JS) or hidden field (form submit))

instead of disabling the dropdown you can replace it with a text/hidden input or read-only text field.

but generally, if you want a selection list to be un-selectable then donít use a selection list (either by omitting in the first place or by replacing it with a more suitable element)
Jul 9 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.