久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      jq怎么去掉html標(biāo)簽

      jq去掉html標(biāo)簽的方法:1、使用remove(),語(yǔ)法“$("選擇器").remove()”;2、使用empty(),語(yǔ)法“$("選擇器").empty()”;3、使用detach(),語(yǔ)法“$("選擇器").detach()”。

      jq怎么去掉html標(biāo)簽

      本教程操作環(huán)境:windows7系統(tǒng)、HTML5&&jquery1.10.2版、Dell G3電腦。

      jQuery去掉html標(biāo)簽

      方法1:使用remove()

      remove() 方法移除被選元素,包括所有的文本和子節(jié)點(diǎn)。

      該方法也會(huì)移除被選元素的數(shù)據(jù)和事件。

      <!DOCTYPE html> <html> 	<head> 		<meta charset="utf-8"> 		<script src="js/jquery-1.10.2.min.js"></script> 		<script> 			$(document).ready(function() { 				$("button").click(function() { 					$("p").remove(); 				}); 			}); 		</script> 	</head> 	<body>  		<p>這是一個(gè)段落。</p> 		<p>這是另一個(gè)段落。</p> 		<button>移除所有P元素</button>  	</body> </html>

      jq怎么去掉html標(biāo)簽

      方法2:使用empty()方法

      empty() 方法移除被選元素的所有子節(jié)點(diǎn)和內(nèi)容。

      注意:該方法不會(huì)移除元素本身,或它的屬性。

      <!DOCTYPE html> <html> 	<head> 		<meta charset="utf-8"> 		<script src="js/jquery-1.10.2.min.js"></script> 		<script> 			$(document).ready(function() { 				$("button").click(function() { 					$("div").empty(); 				}); 			}); 		</script> 	</head> 	<body>  		<div style="height:100px;background-color:yellow"> 			這是一些文本。 			<p>這是div塊中的一個(gè)段落。</p> 		</div> 		<p>這是div塊外部的一個(gè)段落。</p> 		<button>移除div塊中的內(nèi)容</button>  	</body> </html>

      jq怎么去掉html標(biāo)簽

      方法3:使用detach()方法

      detach() 方法移除被選元素,包括所有的文本和子節(jié)點(diǎn)。然后它會(huì)保留數(shù)據(jù)和事件。

      該方法會(huì)保留移除元素的副本,允許它們?cè)谝院蟊恢匦虏迦搿?/p>

      <!DOCTYPE html> <html> 	<head> 		<meta charset="utf-8"> 		<script src="js/jquery-1.10.2.min.js"></script> 		<script> 			$(document).ready(function() { 				$("button").click(function() { 					$("p").detach(); 				}); 			}); 		</script> 	</head> 	<body>  		<p>這是一個(gè)段落。</p> 		<p>這是另一個(gè)段落。</p> 		<button>移除所有P元素</button>  	</body> </html>

      jq怎么去掉html標(biāo)簽

      相關(guān)視頻教程推薦:jQuery教程(視頻)

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)