對不起,真正愚蠢的問題。但它不會以任何方式工作。如何從元素中排除其他元素的html()?
<html>
<head>
<script src='js/jquery.js' type='text/javascript'></script>
<script type='text/javascript'>
$(document).ready(function() {
var htmlcontent = $('.content').not('.dontgrab').html();
alert(htmlcontent); // returns EVERYTHING
});
</script>
</head>
<body>
<div class='content'>
BEFORE
<div class='dontgrab'>DON'T GRAB</div>
AFTER
</div>
</body>
</html>
試過$(「。content *:not('。dontgrab')」)。html(); //返回NULL
請幫忙。
謝謝。
@DavidRodrigues:nope。已經嘗試過。 – 2012-02-04 23:02:15
謝謝你們。我想這將是很容易刪除()元素,然後重新創建它。 – 2012-02-04 23:48:31