doudun8705
2014-04-06 08:23如何使用jquery更改表格单元格颜色
I having a html table with inline edit function,when the user edit the td if the value enter by user lower than zero the td color for specific cell would change without refreshing the page.
For example: if cell =< "-1", background-color=#FF0000
there is any way to make this work in reality?
$("#table td").each( function() {
var thisCell = $(this);
var cellValue = parseInt(thisCell.text());
if (!isNaN(cellValue) && (cellValue >=0)) {
thisCell.css("background-color","#FF0000");
}
});
- 点赞
- 回答
- 收藏
- 复制链接分享
3条回答
为你推荐
- 如何使用jquery更改表格单元格颜色
- html
- javascript
- php
- jquery
- 3个回答
- 使easyui datagrid表格的某个单元格的某个内容改变颜色可以做到吗?
- datagrid
- easyui
- 3个回答