久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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)站

      jquery怎么替換div內(nèi)容

      在jquery中,可以使用html()方法來替換div元素的內(nèi)容,該方法可以設(shè)置并覆蓋所有匹配元素的內(nèi)容,語法為“$("div").html("新的div內(nèi)容")”。

      jquery怎么替換div內(nèi)容

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

      在jquery中,可以使用html()方法來替換div元素的內(nèi)容。

      html() 方法返回或設(shè)置被選元素的內(nèi)容 (inner HTML)。

      當(dāng)給該方法傳入一個(gè)參數(shù),設(shè)置一個(gè)值時(shí),它會(huì)覆蓋所有匹配元素的內(nèi)容。

      語法:

      $(selector).html(content) //或 $(selector).html(function(index,oldcontent))
      參數(shù) 描述
      content 可選。規(guī)定被選元素的新內(nèi)容。該參數(shù)可包含 HTML 標(biāo)簽。
      參數(shù) 描述
      function(index,oldcontent)

      規(guī)定一個(gè)返回被選元素的新內(nèi)容的函數(shù)。

      • index – 可選。接收選擇器的 index 位置。
      • oldcontent – 可選。接收選擇器的當(dāng)前內(nèi)容。

      示例:

      <!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").html("Hello <b>world!</b>"); 				}); 			}); 		</script> 	</head> 	<body>  		<div>這是一段文字。</div> 		<div>這是另一段文字。</div><br> 		<button>改變 div 元素的內(nèi)容</button> 	</body> </html>

      jquery怎么替換div內(nèi)容

      【推薦學(xué)習(xí):jQuery視頻教程、web前端視頻】

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