手风琴上点击
删除股利我有这样的手风琴手风琴上点击
<div id="accordion" class="accord">
<h2>
<a href="#">Item1</a></h2>
<div>
Content1
</div>
<h2 >
<a href="#">Item2</a></h2>
<div>
Content#2
</div>
</div>
$("#accordion").accordion({
autoHeight: false,
animated: 'bounceslide',
icons: { "header": "ui-icon-plus", "headerSelected": "ui-icon-minus" }
});
我想补充的每个项目,将删除该Acoordion事业部,我该怎么做这样的链接?
我看到你没有任何链接去除DIV部分。
假设你有它,这里是我的示例。
$('.remove').click(function(e) {
$(this).parent('div').prev('h2').andSelf().remove();
});
它不工作。当我在firebug中看到$(this).parent('div')给出Object []时,如果我做了父母,我会看到它上面的所有div的列表 – 2013-02-17 20:32:53
也是我的删除链接是在div-table -tr -td – 2013-02-17 20:41:21
这取决于您如何定义标签。只需使用正确的顺序。可以像$(this).parent('div')。andSelf()。remove(); – Purus 2013-02-18 04:31:20
(function ($) { $("#accordion").children("div").each(function(index, element) {
$(element).append('<div class="delete">x</div>');
$(element).children('.delete').bind('click', function() {
$(element).hide();
});
});
}(jQuery));
http://stackoverflow.com/questions/11869622/removing-jquery-ui-accordion – kufudo 2013-02-17 04:44:40