Solved

Disable select

Posted on 2011-09-15
2
291 Views
Last Modified: 2012-05-12
Hi, I would like to disable <select> </select>, but  still want users to see the whole dropdown list,
just not being able to select anything.
0
Comment
Question by:Rozamunda
2 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 36544454
now check this, you can see all of them, but can't select them
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<script>
		function resetBack(thisObj)
		{
			thisObj.selectedIndex = 0;
		}
	</script>
</HEAD>

<BODY>
	<select onchange="resetBack(this)">
		<option value="1">1</option>
		<option value="2">2</option>
		<option value="3">3</option>
		<option value="4">4</option>
		<option value="5">5</option>
		<option value="6">6</option>
	</select>
</BODY>
</HTML>

Open in new window

0
 
LVL 38

Expert Comment

by:Tom Beck
ID: 36544515
To include a visual indication that the list is disabled (grayed out) try this:

<select>
    <option value="val1" disabled="disabled" selected="selected">Value 1</option>
    <option value="val2" disabled="disabled">Value 2</option>
    <option value="val3" disabled="disabled">Value 3</option>
    <option value="val4" disabled="disabled">Value 4</option>
    <option value="val5" disabled="disabled">Value 5</option>
</select>
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how can display objects ? 3 18
c# LinkButton OnClientClick 2 34
Google Sheets Script 21 51
ngStyle with an input variable doesn't work 14 30
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now