Solved

How do you make an item on a drop down list bold?

Posted on 2009-03-30
5
519 Views
Last Modified: 2012-06-21
I have tried using <b> and <em> tags and I still can't get parts of my drop down list to go bold.  Is this possible to do?

<option value="/abc/">Test Page</option>
0
Comment
Question by:Angela123
5 Comments
 
LVL 4

Expert Comment

by:amazingwolf1
ID: 24016967
Hi,
You can't do that in the basic SELECT element.
If you want that functionality, you must implement your own drop down, either in JS or in C#. If you do this with JS I recommend using JQuery which would save you some effort doing that.

Hope this helped!
0
 
LVL 22

Expert Comment

by:neeraj523
ID: 24016999
hello

here you go..
<select SIZE="1" NAME="ListBoxURL">
	<option value="1">One</option>
	<option style="font-weight: bold;" value="2">Two</option>
	<option value="3">Three</option>
	<option value="4">Four</option>
</select>

Open in new window

0
 
LVL 4

Accepted Solution

by:
amazingwolf1 earned 20 total points
ID: 24017041
neeraj523, your example doesnt work.

Angela123 - see MSDN documentation about the option element. It does not have an option to set the font property like you need it:

http://msdn.microsoft.com/en-us/library/ms535877(VS.85).aspx#

So I think my response above gave you a direction where to start.

0
 
LVL 4

Expert Comment

by:KrisTheComputerGuy
ID: 24017261
You change the font styling for the select box as a whole, but styling for individual options ignored. I suggest focusing on why you want certain options bolded and finding a another way to make that happen. For now I'm going to assume the point of bolding is to suggest one or more options as the better choice(s).

One solution could be to simply designate one option as "selected" when the page loads.  

<option selected value="2">Two</option>


Another solution may involve differentiating objects in the select is by adding a unique like symbol (like * &/or **) to the end of the text for the option item. Then place a description for that symbol at the bottom of the page.

<option value="2">Two **</option>

Later...
**<i> Option Two is suggested for such & such reason</i>


Hope that helps

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24018266
The CSS does however work in non-IE browsers
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Javascript Case Expression 7 29
jQuery Validate 4 36
How do specify keydowns in JavaScript 3 44
Browser Chrome downloads colored link 5 41
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

770 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