我有一个div,其中包含一个包含文本的段落标记。 我想要的是去除p标签,但保留文本在div?这是可能的jQuery中?如何删除一个div内的p标签?
<div id="footright"><p>Circus</p></div>
我有一个div,其中包含一个包含文本的段落标记。 我想要的是去除p标签,但保留文本在div?这是可能的jQuery中?如何删除一个div内的p标签?
<div id="footright"><p>Circus</p></div>
是:
$('#footright').text($('#footright').text());
$("#footright>p").replaceWith(function() { return $(this).contents(); });
有很多方法可以做到这一点。我可能会一起去:
$('#footright > p').contents().unwrap();
你可以去:
$('#footright > p').html("");
操纵与jQuery的DOM?是的,它*可能*是可能的。 – JJJ 2012-02-16 10:03:43