当我单击红色方块时,我希望整个 div 消失。不仅仅是现在正在发生的方块。这是我的 JS
$('document').ready(function(){
$('.theListItem .red').click(function(){
var $toRemove = $(this).parent('div').prev('h3');
$toRemove = $toRemove.add($(this).parent('div'));
$toRemove.animate({height:0}, 500, function(){
// This is the callback.
$toRemove.remove();
});
return false;
});
});
这是一些html
div class = "theListItem" data-role="collapsible-set" data-collapsed="false">
<div data-role="collapsible" data-collapsed="false" data-theme="a">
<h3>Keep Working!</h3>
<div data-role="controlgroup" data-type="horizontal">
<a class= "green" href="categorize.html" data-transition="slide" data-role="button">Yes</a>
<a class="red" href="#" data-role="button">No</a>
<a class="blue" href="index.html" data-role="button">Maybe</a>
</div>
</div>
<div data-role="collapsible" data-collapsed="false" data-theme="a">
<h3>Section 1</h3>
<div data-role="controlgroup" data-type="horizontal">
<a href="categorize.html" data-role="button">Yes</a>
<a href="index.html" data-role="button">No</a>
<a href="index.html" data-role="button">Maybe</a>
</div>
</div>