欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          jQuery html()方法有什么用

          html()方法用于返回或設(shè)置被選元素的內(nèi)容:1、如果未設(shè)置參數(shù),則返回被選元素的當(dāng)前內(nèi)容,語法“$(selector).html()”;2、如果設(shè)置參數(shù),則會覆蓋所有匹配元素的內(nèi)容,語法“$(selector).html(內(nèi)容值)”。

          jQuery html()方法有什么用

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

          jQuery html()方法

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

          • 返回元素內(nèi)容

          當(dāng)使用該方法返回一個(gè)值時(shí),它會返回第一個(gè)匹配元素的內(nèi)容。

          語法

          $(selector).html()

          示例:

          <!DOCTYPE html> <html>  	<head> 		<meta charset="utf-8"> 		<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"> 		</script> 		<script> 			$(document).ready(function() { 				$("button").click(function() { 					alert($("p").html()); 				}); 			}); 		</script> 	</head>  	<body> 		<p>這是一個(gè) <b>段落</b>。</p> 		<button>返回P標(biāo)簽的內(nèi)容</button>  	</body>  </html>

          jQuery html()方法有什么用

          • 設(shè)置元素內(nèi)容

          當(dāng)使用該方法設(shè)置一個(gè)值時(shí),它會覆蓋所有匹配元素的內(nèi)容。

          語法

          $(selector).html(content)

          content:規(guī)定被選元素的新內(nèi)容,可省略。該參數(shù)可包含 HTML 標(biāo)簽。

          示例:

          <!DOCTYPE html> <html>  	<head> 		<meta charset="utf-8"> 		<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"> 		</script> 		<script> 			$(document).ready(function() { 				$("button").click(function() { 					$("p").html("Hello <b>world!</b>"); 				}); 			}); 		</script> 	</head>  	<body>  		<p>這是一個(gè)段落。</p> 		<p>這是另一個(gè)段落。</p> 		<button>修改所有P元素的內(nèi)容</button> 	</body>  </html>

          jQuery html()方法有什么用

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

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