怎样在id为Grid的表单中给值<60的td标背景色为红色且加粗?找一下错在哪?

ilikethat163 2013-04-21 02:40:34

$('#Grid td').filter(text<60).css('background-color', 'red')
.css('font-weight','bold');
...全文
166 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
「已注销」 2013-04-21
  • 打赏
  • 举报
回复
filter好像没有比较大小的吧 $('#Grid td').each(function(){ if(+$(this).text()<60){ $(this).css({ 'background-color':'red', 'font-weight':'bold')}); } });
  • 打赏
  • 举报
回复

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
	$(function(){
		$('#Grid td').each(function(){
			if($(this).text()<60){
				$(this).css('background-color', 'red') .css('font-weight','bold');
			}
		});
	})
</script>

87,992

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧