I want to add a css {padding : 0px 8px 0px 2px}
to all td's of a particular tr. tr is like this: $('#' + rowid)
$('#' + rowid).find("td").css("padding", "0px 8px 0px 2px");
$('#' + rowid)
gets the tr
element. .find("td")
gets all td
elements nested in your tr
element. .css("padding", "0px 8px 0px 2px")
applies the relevant styles to your td
elements. Try this:
$('td', '#' + rowid).css('padding', '0px 8px 0px 2px');
Or better yet, put the padding
in a class in your stylesheet and use addClass
as it's a better separation of concerns.
try this...
$('.' + rowclass).find("td").css("padding", "0px 8px 0px 2px");
you can not use same id
for more than one tag ,so you have to use class
for that ,because tags can have same class but not same Id
Try like below... it will work
var ele = '#' + rowid;
$(ele + " td").css('padding', '10px 8px 0px 2px');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.