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\');
我在想什么吗...?这肯定行得通吗?!     
已邀请:
        上面的代码确实有效,但我的jQuery文件中的其他内容却抛出了问题。请参阅上面的评论。     

要回复问题请先登录注册