jQuery目标html5标记属性
|
我正在尝试使用jQuery来简单地添加
.alt
类来替换主section
中的article
块,如下所示:
html5:
<section id=\"content\" role=\"main\">
<h1>Main Title</h1>
<article id=\"post-1\" class=\"post-1 post type-post\">
.. article content ..
</article>
<article id=\"post-2\" class=\"post-2 post type-post\">
.. article content ..
</article>
<article id=\"post-3\" class=\"post-3 post type-post\">
.. article content ..
</article>
</section>
jQuery的:
$(\'#content article:nth-child(odd)\').addClass(\'alt\');
我在想什么吗...?这肯定行得通吗?!
没有找到相关结果
已邀请:
1 个回复
卧沫