473,324 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

how can I make a dropdownlist control readonly using javascript?

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
1 6240
Dormilich
8,658 Expert Mod 8TB
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

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

Similar topics

2
by: Ali | last post by:
I am adding a DropDownList control to my DataGrid footer template. I load my DropDownList using a function that returns an arrayList. I can see all my items in the DropDownList, but when I select...
10
by: GP | last post by:
Is it possible to iterate through all the controls collection and make the textboxes alone as read only.I don't see a readonly property for the Control.Can some one help me in this context? I...
6
by: Oscar | last post by:
I want to add items to a dropdownlist control within a Javascript eventhandler. This is what I code : var dd = document.getElementById("DropDownList1"); dd.Items.Add("1990");...
1
by: Steve | last post by:
Hi I've created a custom dropdown list in a web control library that my aspx page uses as follows: <%@ Register Assembly="CommonUI" Namespace="POLISY.Web.UI.Common" TagPrefix="cc1" %> .......
2
by: glenn | last post by:
Hi folks, I am trying to determine which item in a DropDownList Web control has been selected. I have posted an OnSelectedIndexChanged subroutine in my code with a reference to the subroutine...
3
by: John Kotuby | last post by:
Hi all... I am trying to do a simple thing and maybe am missing something elementary. I have created a Javascript function at the top of a page which is meant to enable editing of an HTML input...
1
by: shotokan99 | last post by:
on my page, i embedded wmp this way: <object id="mplayer" codebase=http://activex.microsoft.com/activex/ con... type=application/x-oleobject align=absmiddle classid=CLSID:22d6f312-b0f6-11......
0
by: howa | last post by:
I have an iframe, say it load page at another domain, e.g. google.com for example, using standard iframe HTML tag. I want to change the font-size, background of the remote iframe which I have no...
0
by: AnuGarg | last post by:
Hi All, I am working in ASP.Net project. I have one gridview and data is bound from codebehind cs file. In some of the columns I am showing them links to open popup & also data. Now my task is...
1
by: ahmednawazbutt | last post by:
I have an .htm page wwhich consits of a frame with 0 border,width and height Now, when I enter a key,i.e onkeyup (keyboard pressing)event occurs, the form is submitted to asp.net page, which...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.