我有一点问题,目标一些div's没有类,位于表结构:
<table class="blog" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top">
<div> <--- I want to target this
<table class="some_table_class">
<tbody>
<tr>
<td class="someclass" valign="top">
<div>This div should stay untouched, and every of his potential div children</div>
</td>
</tr>
</tbody>
</table>
</div>
<div></div> <--- I want to target this
<div></div> <--- I want to target this
<div></div> <--- I want to target this
.
.
.
</td>
</tr>
</tbody>
</table>
我试着在CSS .blog td[valign="top"]>div
中这样做但这个也影响了第二个div +似乎IE不理解[valign="top"]是什么
所以我想用jQuery为div添加一些类
有什么有效的方法来做到这一点吗?
.blog>tbody>tr>td>div
…有点奇怪,用起来很长,我觉得
谢谢你的建议
我忘了…我可以用jquery编辑html结构,我不能访问。php/。html文件
try this
$('td[valign="top"]').find("div") // this will find all the divs
更新strong>
要么你用类选择器命名所有div,然后用类选择器得到它。
或者您可以使用not()
来排除…但是需要给出一个应该被排除的id或类…