我正在处理响应式表格,如果行内容与当前日期匹配,则希望将其设为粗体。
我将第一个孩子和 td 隐藏起来,因为我只需要它来执行某些功能
基于价值 <td data-label="TodaysDate">06-05-2020</td>和<td data-label="Date">05-05-2020</td>
如果值 if TodaysDate = Date那么我需要将此行加粗。
我怎么能用javascript做到这一点
https://codepen.io/KGuide/pen/MWwMZzP
function compareCellValues() {
var rows = $(".ramadan-time").find("tbody tr"); //returns all table rows
rows.each(function() { //iterate over each row.
var thisRow = $(this), //this is the current row
TodaysDate = thisRow.find(".TodaysDate"), //this is the first value
sDate = thisRow.find(".Date"); //this is the second value
if (TodaysDate.text() !== sDate.text()) {
thisRow.css("font-weight", "bold");
}
thisRow.find(".TodaysDate").text(parseInt(TodaysDate.text()) - parseInt(sDate.text()));
});
}
window.onload = compareCellValues();
呼唤远方
相关分类