Solved

"Please select" on Combo

Posted on 2012-04-12
2
178 Views
Last Modified: 2012-04-12
Is it possible to have "please select" in combo boxes in HTML?

Ive got some simple code:-
			<select id="Q2">		
				<option value="Management">Management</option>
				<option value="Finance">Finance</option>
				<option value="Administration">Administration</option>
				<option value="Human Resources">Human Resources</option>
				<option value="Marketing">Marketing</option>
				<option value="Communications">Communications</option>
				<option value="Engineer">Engineer</option>			
			</select> 

Open in new window


What I would like to do is have the initial text set to 'Please select', but not have it as an option that the user can selects when it drops down.

Im assuming it will need some Javascript, but thought Id ask the question before playing around to get a script to do it.

Thank you
0
Comment
Question by:tonelm54
2 Comments
 

Accepted Solution

by:
tonelm54 earned 0 total points
ID: 37838586
Found the answer :-)

			<select id="Q2">		
				<option value="" disabled="disabled" selected="selected">Please select a position</option>
				<option value="Management">Management</option>
				<option value="Finance">Finance</option>
				<option value="Administration">Administration</option>
				<option value="Human Resources">Human Resources</option>
				<option value="Marketing">Marketing</option>
				<option value="Communications">Communications</option>
				<option value="Engineer">Engineer</option>			
			</select> 	

Open in new window

0
 
LVL 1

Expert Comment

by:rjccomps
ID: 37838608
<html>
<div>
<select name="menu">
<option value="0" selected>(please select:)</option>
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
<option value="other">other, please specify:</option>
</select>
<div><input type="submit" value="submit"></div>
</html>

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

759 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

25 Experts available now in Live!

Get 1:1 Help Now