Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

Disable select

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
Rozamunda
Asked:
Rozamunda
1 Solution
 
Gurvinder Pal SinghCommented:
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
 
Tom BeckCommented:
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now