Style the Dropdown

I have a dropdown that I want to change to another style. Black borders, black background, different arrow and so on.. how do i find an easy way for this? Thank's in advanced.

Beginner now. Intermediate later :)
LVL 1
dingirAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pravin AsarPrincipal Systems EngineerCommented:
Easier way is change the style class

Here is sample code.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<title>Toggle Style for Select/Dropdown - Pravin Asar</title>
		<style type="text/css">
			select.one {
	background-color: #4499dd;
	font-size: 20px;
	border: none;
	width: 400px;
	}
	select.two {
	background-color: #dd9944;
	font-size: 30px;
	color: #ffffff;
	width: 200px;
}	
</style>
<script language="JavaScript">
	function ToggleClass() {
		if (document.getElementById('select1')) {
			if (document.getElementById('select1').className.match('one')) {
				document.getElementById('select1').className = 'two';
			}
			else {
				document.getElementById('select1').className = 'one';
				
			};
		}
	}
</script>
</head>
	<body>
		<a href="#" onclick="ToggleClass();">Toggle Style for Dropdown/ComboBox</a>
		<div>
			<select id="select1" class="one">
				<option value="1">Option Value 1</option>
				<option value="2">Option Value 2</option>
				<option value="3">Option Value 3</option>
			</select>
		</div>
	</body>
</html>

Open in new window

0
Pravin AsarPrincipal Systems EngineerCommented:
If you want to do this with  Jquery,

look at following code.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Jquery : Simple Class Toggle Example </title>
		<style type="text/css">
			select.one {
				background-color: #4499dd;
				font-size: 20px;
				border: none;
				width: 400px;
			}
			select.two {
                background-color: #dd9944;                
                font-size: 30px;                
                color:#ffffff;
                width:200px;
                }				
		</style>
		<script language="JavaScript" src="lib/jquery/jquery-1.3.2.min.js">
		</script>
    </head>
    <body>
		<a href="#" onclick="$('#select1').toggleClass('two');">Toggle Style for Dropdown/ComboBox</a>
		<div>
			<select id="select1" class="one">
				<option value="1">Option Value 1</option>
				<option value="2">Option Value 2</option>
				<option value="3">Option Value 3</option>
			</select>
		</div>
		
    </body>
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.