Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to set border color in a select in table row

Posted on 2014-10-04
8
Medium Priority
?
132 Views
Last Modified: 2014-10-30
I have a table with one row that has a "select".  I want to change the border of just the "select".  Every solution that I've tried changes the border of the entire row.

Here's the code that I'm using:
<td>
	            <div style="border: 1px solid #ff0000;">
				<select name = "SIC" width = "20%"> 
				<?php	
					//Iterate through Siccode File and populate drop down
					$SqlString1 = "SELECT * FROM siccoder";
					$Siccode_Data = mysql_query($SqlString1,$conn);
					while ($ROW2 = Mysql_fetch_assoc($Siccode_Data, MYSQL_BOTH))
					{
						echo "<option value = \"";
						echo $ROW2['SIC'];
						echo "\"";
						if ($ROW2['SIC'] == $ROW['SICCODE'])
					 	{
							echo " selected";
						}
						echo ">";
						echo $ROW2['DESCR'];
						echo "</option>";
			    	}
 				?>
                </select>
                </div>
			</td>

Open in new window

0
Comment
Question by:breeze351
8 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40361740
You would need to give the TD a class or ID to target it else use some jquery

$("[name=SIC]").closest("td").css("border","1px solid black")
0
 
LVL 60

Accepted Solution

by:
Julian Hansen earned 2000 total points
ID: 40361823
By select I am assuming you mean the select dropdown. This css should do it

select[name="SIC"] {
    border: 1px solid red;
}

Open in new window

0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 40362135
No points for this, but please get off the MySQL extension.  The official deprecation and removal notice is by now years old, and your scripts will have to be changed.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/A_11177-PHP-MySQL-Deprecated-as-of-PHP-5-5-0.html
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 58

Expert Comment

by:Gary
ID: 40362136
Dunno why I thought he meant the cell, maybe he because he talks about every cell gets the border.
0
 
LVL 58

Expert Comment

by:Gary
ID: 40395395
@breeze351
Care to explain your selected answer - it has nothing to do with your question and was only Ray giving some advice about your db connections.
0
 

Author Closing Comment

by:breeze351
ID: 40414249
Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

885 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