[英]Style a Specfic Column of a specific Row of a Table
a table 一张桌子
to style a specific td of a specific row of a table. 设置表格特定行的特定td的样式。
to loop through each row
, in each row, I loop through each td
, and check if that td
is equal to the one I want to check. 循环遍历每一
row
,在每一行中,我循环遍历每个td
,并检查该td
是否等于我想要检查的那个。
$('#account-table').each(function () {
$(this).find('td').each(function () {
var td = $(this);
if(td.innerText == 'vazogaxan@hotmail.com'){
$(this).css('color','red');
}
});
});
I couldn't get that column text to be red . 我无法将该列文本变为红色 。
Any hints / suggestions ? 任何提示/建议?
innerText
is a vanilla JS property, but you have a jQuery object and you try to access a inexistent property. innerText
是一个vanilla JS属性,但你有一个jQuery对象,你试图访问一个不存在的属性。 Use text()
method instead 请改用
text()
方法
if(td.text() == 'vazogaxan@hotmail.com'){
More info: 更多信息:
http://api.jquery.com/text/ http://api.jquery.com/text/
https://developer.mozilla.org/es/docs/Web/API/Node/innerText https://developer.mozilla.org/es/docs/Web/API/Node/innerText
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.