[英]Remove the Parent Div, but not what's inside the parent.
嘿,我不确定这是否可行,但无论如何。 比如说:
<div id="foo">
<a href="#" id="bar">Remove Parent</a>
</div>
$(function() {
$('#bar').click(function() {
$(this).parent().remove();
});
});
您是否可以删除父容器,在此示例中为#foo
但保留子锚标记#bar
?
这条路:
$(function() {
$('#bar').click(function() {
$("#bar").insertAfter("#foo");
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.