欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery中empty()方法用法實例

 更新時間:2015年01月16日 15:07:00   投稿:shichen2014  
這篇文章主要介紹了jQuery中empty()方法用法,以實例形式分析了empty()方法的功能、定義及將匹配元素中的所有內(nèi)容移除的使用技巧,需要的朋友可以參考下

本文實例講述了jQuery中empty()方法用法。分享給大家供大家參考。具體分析如下:

此方法能夠?qū)⑵ヅ湓刂械乃袃?nèi)容移除,包括所有文本和子節(jié)點。

語法結(jié)構(gòu):

復(fù)制代碼 代碼如下:
$(selector).empty()

實例代碼:

復(fù)制代碼 代碼如下:

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.dbjr.com.cn/" />
<title>腳本之家</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>
</head>
<body>
<div>
  <ul>
    <li>腳本之家</li>
  </ul>
</div>
<button>點擊查看效果</button>
</body>
</html>

希望本文所述對大家的jQuery程序設(shè)計有所幫助。

相關(guān)文章

最新評論