Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
36
rated 0 times [  41] [ 5]  / answers: 1 / hits: 27796  / 15 Years ago, fri, january 29, 2010, 12:00:00

i have the following format :



<div id=container1>
<div id=post> blah blah blah </div>
<div id=post> blah blah blah </div>
<div id=post> blah blah blah </div>
</div>

<div id=container2>
<div id=post> blah blah blah </div>
<div id=post> blah blah blah </div>
<div id=post> blah blah blah </div>
</div>


I want a jQuery code to remove the last post DIV in the container1 with a fading effect.



Important : the container1 does not have a specified post DIVs number. so the code should just select the last POST div in the container1 div.



Thanks


More From » jquery

 Answers
7

$('#container1 #post:last').fadeOut() would remove the last div with the ID post in container1.



Also, like Gumbo said, IDs should be unique. However, this jQuery code will still work.


[#97713] Wednesday, January 27, 2010, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
byrondonavanc

Total Points: 675
Total Questions: 107
Total Answers: 105

Location: Peru
Member since Fri, Oct 14, 2022
2 Years ago
byrondonavanc questions
;