This example describes the use of the empty () method in jquery. Share to everyone for your reference. The specific analysis is as follows:
This method can remove all content from the matching element, including all text and child nodes.
Syntax structure:
Copy Code code as follows:
Instance code:
Copy Code code as follows:
<! DOCTYPE html>
<meta charset= "Utf-8" >
<meta name= "Author" content= "http://www.jb51.net/"/>
<title> Cloud-dwelling community </title>
<style type= "Text/css" >
div{
height:200px;
width:200px;
BORDER:1PX Solid Red
}
UL li{
BORDER:1PX solid blue;
height:100px;
width:100px;
}
</style>
<script type= "Text/javascript" src= "Mytest/jquery/jquery-1.8.3.js" ></script>
<script type= "Text/javascript" >
$ (document). Ready (function () {
$ ("button"). Click (function () {
$ ("div"). empty ();
});
})
</script>
<body>
<div>
<ul>
<li> Cloud-dwelling community </li>
</ul>
</div>
<button> Click to view Effect </button>
</body>
I hope this article will help you with your jquery programming.