开发者

how can I set HTML body's first table's first'row first's td's height using Jquery?

开发者 https://www.devze.com 2023-02-15 03:19 出处:网络
how can I set HTML body\'s first ta开发者_如何转开发ble\'s first\'row first\'s td\'s height using Jquery?$(\'body table:first tr:first td:first\').height(500);Depending on the meaning of your question

how can I set HTML body's first ta开发者_如何转开发ble's first'row first's td's height using Jquery?


$('body table:first tr:first td:first').height(500);


Depending on the meaning of your question..

To get the first td on the page (which will be the first td of the first tr of the first table).

$("td:first").css("height", "65");

but if you want to set the height of all the td's of the first tr

$("tr:first td").each(function(index)
     $(this).css("height", "65");
});

But modifying the height of one cell will mean all the other cells are of that set height anyway.


Here is the code:

$("table:first tr:eq(0) td:first-child").css("height","300");

But there is one more thing: if you modify a cell height, all the others from the same row will follow.


$($($($('body').first('table')).first('tr')).first('td')).height(500);
0

精彩评论

暂无评论...
验证码 换一张
取 消