jQuery找到指定背景颜色的td_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 08:51:03
Original
1285 people have browsed it

怎么找到指定颜色的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)");                    }                });
Copy after login

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


回复讨论(解决方案)

定义cssclass用class来找

定义cssclass用class来找

具体说一下

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

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

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

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



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

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

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

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


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

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



多钟颜色的背景   是不是要定义多个class
keyile 
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template