Drop Down List
-
Hi everyone, I have an aspx page, in this aspx page I have a drop down list, I want to set this drop down list to Read only so the user can't change the selected value, I want to set this drop down list to Read only in Javascript and not using the code behind, what property should I use?? Thanks.
-
Hi everyone, I have an aspx page, in this aspx page I have a drop down list, I want to set this drop down list to Read only so the user can't change the selected value, I want to set this drop down list to Read only in Javascript and not using the code behind, what property should I use?? Thanks.
-
There is no read only property for the select element. You can set the disabled property to true, which is similar to read only. The field will not be included when you post the form, though. --- b { font-weight: normal; }
-
Thanks, I used the disabled property. Now I want to hide the first two elements in the drop down list, how can I do that using javascript. thanks again.
-
In what way do you want to hide them? Do you want to remove them?
document.FormName.FieldName.options[1] = null; document.FormName.FieldName.options[0] = null;
--- b { font-weight: normal; } -
Thanks Guffa but I don't want to remove them, depending on a radio button choice, I want to hide the first two elements. If the user select another radio button I want to show these 2 elements, How can this be done in Javascript? thanks again.