How to change width of td using jquery

Posted by Klbaiju under jQuery on 8/13/2017 | Points: 10 | Views : 310 | Status : [Member] | Replies : 2
Hi,

In my application ,i want display 2 buttons in a td horizondally.

but it is displaying one below other. the td is rendered as follows

<td class="109" >
<input value="Edit" id="edit" type="button">

<input value="Cancel" id="cancel" type="button">
</td>

i tried to change the width as 140px

like

$('.109').width("120px");

but it is not working.

my requirement is to display 2 buttons horizondally in the td

how to solve this

regards

Baiju




Responses

Posted by: A2H on: 8/14/2017 [Member] [MVP] Silver | Points: 25

Up
0
Down
If your table has proper width then button should appear in single line. Try applying width to table instead of td

Add below css to your page

<style>
.tablecss
{
width:100% !important;
}
</style>

Then apply to table like below

<table class="tablecss" border="1">
<tr>
<td class="109" >
<input value="Edit" id="edit" type="button">

<input value="Cancel" id="cancel" type="button">
</td>
</tr>
</table>

Also if your table is inside any container controls like div or panel then make sure you have applied enough width to container controls as well

Thanks,
A2H
My Blog

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shreedar on: 9/19/2017 [Member] Starter | Points: 25

Up
0
Down
Hi
Find the below code to change width of your td.

<div class="109">

<input value="Edit" id="edit" type="button">

<input value="Cancel" id="cancel" type="button">
</div>

<script>
$(".109").css("width", 140);
<script>


Regards

Sridhar Thota.
www.dotnet-sridhar.blogspot.com

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response