• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 421
  • Last Modified:

<th> tag -- I want to align the text left

Using jQuery, I want to align the indicated <th> tag to the left  (right now it is centered)

<th scope="col">Details</th>

Here is the code segment:

<table class="grid_view" cellspacing="0" id="ctl08_gvRepairItems" style="width:300px;border-collapse:collapse;">
		<tbody><tr class="grid_view_header">
			<th scope="col">&nbsp;</th><th scope="col">Repair Item</th><th scope="col">Units</th>

\\\\\\\\\\\  right now this is centered, I want to align it to the LEFT

<th scope="col">Details</th>

		</tr><tr id="ctl08_gvRepairItems_ctl02" onclick="HighLightGVRow('ctl08_gvRepairItems_ctl02', 'ctl08_gvRepairItems_ctl02_hdSelectedRow', 'ctl08_gvRepairItems_ctl02_hdOldStyle');">
			<td style="width:100px;">
                                            <a id="ctl08_gvRepairItems_ctl02_lnkDelete" href="javascript:__doPostBack('ctl08$gvRepairItems$ctl02$lnkDelete','')" style="display:inline-block;width:40px;">Delete</a>
                                            <span id="ctl08_gvRepairItems_ctl02_lblRepairItem">Carpet Cleaning</span>
                                            <span id="ctl08_gvRepairItems_ctl02_lblUnits">SF</span>
                                            <span id="ctl08_gvRepairItems_ctl02_lblDetails" style="display: inline-block; width: 800px; text-align: left;">asfasd</span>
                                        </td><td><input type="hidden" name="ctl08$gvRepairItems$ctl02$hdSelectedRow" id="ctl08_gvRepairItems_ctl02_hdSelectedRow"><input type="hidden" name="ctl08$gvRepairItems$ctl02$hdOldStyle" id="ctl08_gvRepairItems_ctl02_hdOldStyle"></td>

Open in new window

Tom Knowlton
Tom Knowlton
1 Solution
$('.grid_view_header th:eq(3)').css({
    textAlign: 'left'

Open in new window

All this is doing is injecting inline styles....you can do this with css too, which would be a better way to do it....
Tom KnowltonWeb developerAuthor Commented:
This worked perfectly!


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now