I want to set the drop down as readonly.
For that I user the code readonly="readonly"
.But its not working in asp.netmvc4.How can I solve this problem?Please help
You need to add a "disabled" property to the form dropdown class.
Dropdown (select element) is always read only. User do not edit it. User can select any of the option of its own chice. Unlike other html elements, it dont have a attribute which can make the element readony and prevent users to change its value.
You also can remove the duplicates from the table list firstly, then create the drop down list. Select the column range you want to use in the table, the press Ctrl + C to copy it, and place it to another position by pressing Ctrl + V. Then keep selecting the list, click Data > Remove Duplicates.
To make a textarea and input type read only, use the attr() method .
You can do like this
Make other options disabled except the current one.
$('option:not(:selected)').attr('disabled', true);
See Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With