Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
22
rated 0 times [  28] [ 6]  / answers: 1 / hits: 63230  / 13 Years ago, wed, october 19, 2011, 12:00:00

I have this HTML code:



<div id=note_list>
<div class=note>
Text 1
<a href=>X</a>
</div>
<div class=note>
Text 2
<a href=>X</a>
</div>
<div class=note>
Text 3
<a href=>X</a>
</div>
<div class=note>
Text 4
<a href=>X</a>
</div>
<div class=note>
Text 5
<a href=>X</a>
</div>
</div>


Now I would like to use jQuery to delete a <div> element AFTER the 'X' clicking, is it possible?



First X closes:



  <div class=note>
Text 1
<a href=>X</a>
</div>


etc etc.
Can I remove a div without using id=?



Thank you!


More From » jquery

 Answers
4
$(.note a).click(function(e) {
e.preventDefault();
$(this).parent().remove();
});


or instead of remove() you could use slideUp()


[#89535] Tuesday, October 18, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
breap

Total Points: 606
Total Questions: 96
Total Answers: 108

Location: Djibouti
Member since Sun, Feb 27, 2022
2 Years ago
breap questions
Thu, Jun 24, 21, 00:00, 3 Years ago
Wed, Mar 18, 20, 00:00, 4 Years ago
Mon, Oct 7, 19, 00:00, 5 Years ago
;