Saturday, June 1, 2024
 Popular · Latest · Hot · Upcoming
30
rated 0 times [  31] [ 1]  / answers: 1 / hits: 28822  / 14 Years ago, fri, may 7, 2010, 12:00:00

This is my HTML:



        <p class=first>blah blah <a href= class=more>read more</a></p>
<div class=read_more>
<p>more text</p>
</div>


And javascript:



$(document).ready(function(){
$('a.more').click(function(){
$(this).find('.read_more').slideDown();
return false;
});
});


Doesn't seem to do anything (read_more is set to display: none) any ideas?


More From » jquery

 Answers
44

Try this:




$(document).ready(function(){
$('a.more').click(function(){
$(this).parent().next().find('.read_more').slideDown();
return false;
});
});



Update:



Here is the demo :)



Code:



$(document).ready(function(){
$('a.more').click(function(){
$(this).parents().find('.read_more').slideDown('slow');
return false;
});
});


You could also do:



$(document).ready(function(){
$('a.more').click(function(){
$('.read_more').slideDown('slow');
return false;
});
});


Or this:



$(document).ready(function(){
$('a.more').click(function(){
$(this).parent().next().slideDown('slow');
return false;
});
});

[#96851] Tuesday, May 4, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
katieh

Total Points: 692
Total Questions: 104
Total Answers: 104

Location: Armenia
Member since Sat, Dec 31, 2022
1 Year ago
;