您好,欢迎来到字泊教育。
搜索
您的当前位置:首页jQuery找到指定背景颜色的td_html/css

jQuery找到指定背景颜色的td_html/css

来源:字泊教育


怎么找到指定颜色的td表格
----
$("#hutNew").find("td").each(function () { if ($(this).attr('style') == 'background:rgb(34, 139, 34)') { $(this).css({ "width": "140px", "cursor": "pointer" }); } else if ($(this).attr('style') == 'background:none') { $(this).css("background", "rgb(85, 85, 85)"); } });

-------
这个方法不好使啊
---


回复讨论(解决方案)

定义cssclass用class来找

定义cssclass用class来找

具体说一下

.backcolor{background:rgb(34, 139, 34)}

if($(this).attr('class')=="backcolor"){//}

.backcolor{background:rgb(34, 139, 34)}

if($(this).attr('class')=="backcolor"){//}



多钟颜色的背景 是不是要定义多个class

.backcolor{background:rgb(34, 139, 34)}

if($(this).attr('class')=="backcolor"){//}

好吧 试过了 不行
我要实现多次点击一个Td 然后两种颜色不停的变化 记录下最后一次点击的改变后的颜色 class 好像 只能点击一次


.backcolor{background:rgb(34, 139, 34)}

if($(this).attr('class')=="backcolor"){//}



多钟颜色的背景 是不是要定义多个class

keyile

Copyright © 2019- zipou.cn 版权所有

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务