0
我试图使用jQuery简单地添加一个.alt
类交替内的主section
article
块如下:jquery的目标HTML5标记属性
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');
我错过了什么......?当然这应该工作?!
它看起来像它对我有用 - http://jsfiddle.net/interdream/EBWPq/ – 2011-06-15 14:43:32
XO你说得对,它是我的jquery文件中的其他内容阻止它!谢谢,我正在拉我的头发! – 2011-06-15 14:49:17
@Jonny Wood - 请将您的评论回复并标记为已接受。 – cdeszaq 2011-09-16 16:31:34