开发者

jquery target html5 markup attributes

I'm trying to use jQuery to simply add an .alt class to alternate article blocks within a main section as follows:

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(开发者_如何学Goodd)').addClass('alt');

Am I missing something...? Surely this should work?!


The above code does work, other content in my jQuery file was throwing out problems. See the comments above.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜