JavaScript Tutorial/jQuery/empty
empty(): remove all event handlers and internally cached data.
<source lang="javascript">
<html>
<head> <script type="text/javascript" src="js/jquery-1.3.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("p").click(function () { $(this).empty(); }); }); </script>
</head> <body> <body>
World
Replaced!
</body>
</html></source>
Remove all child nodes
<source lang="javascript">
<html>
<head> <script type="text/javascript" src="js/jquery-1.3.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("p").empty(); }); </script>
</head> <body> <body>
Hello
</body>
</html></source>