Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
108
rated 0 times [  109] [ 1]  / answers: 1 / hits: 22806  / 11 Years ago, mon, march 11, 2013, 12:00:00

I have an HTML table. How can I change the width of one of the cells of that table from Javascript code? For example, I have a button, and when I press it, I want the width of one particular column to be changed. How can I do this?


More From » html-table

 Answers
15

Here's how you might do it with jQuery, a popular JavaScript library:



http://jsfiddle.net/VJTnN/2



$('td:nth-child(2)').css('width', '100px');

[#79687] Saturday, March 9, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ramiro

Total Points: 431
Total Questions: 96
Total Answers: 105

Location: Northern Ireland
Member since Mon, Nov 14, 2022
2 Years ago
ramiro questions
Thu, May 7, 20, 00:00, 4 Years ago
Tue, Apr 28, 20, 00:00, 4 Years ago
Sun, Feb 16, 20, 00:00, 4 Years ago
;