Solved

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

Posted on 2009-03-30
5
518 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

914 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

16 Experts available now in Live!

Get 1:1 Help Now