collapse row by row with (jQuery)

Posted by Mini on Stack Overflow See other posts from Stack Overflow or by Mini
Published on 2011-01-15T12:21:03Z Indexed on 2011/01/15 12:53 UTC
Read the original article Hit count: 88

Filed under:
|

I want to hide/show a lot of contents by id

Here is an example:

<a href="#" class="click"> title here </a>
<p class="content" id="1">
text here ...
</p>

<a href="#" class="click" id="2"> another title here </a>
<p class="content">
another text here ...
</p>

I can add an ID into my HTML code. How Can I get it by jQuery?

The jQuery lines:

<script type="text/javascript">
$(document).ready(function(){
$('.content').hide();
$('.click').click(function() {
$('.content').slideToggle(500);
return false;
});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about hideshow