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