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.
精彩评论