jquery學(xué)習(xí)之二屬性(html()與html(val))_jquery
來源:懂視網(wǎng)
責(zé)編:小采
時間:2020-11-27 20:55:56
jquery學(xué)習(xí)之二屬性(html()與html(val))_jquery
jquery學(xué)習(xí)之二屬性(html()與html(val))_jquery:html() 取得第一個匹配元素的html內(nèi)容。這個函數(shù)不能用于XML文檔。但可以用于XHTML文檔。 Get the html contents of the first matched element. This property is not available on XML documents (although it
導(dǎo)讀jquery學(xué)習(xí)之二屬性(html()與html(val))_jquery:html() 取得第一個匹配元素的html內(nèi)容。這個函數(shù)不能用于XML文檔。但可以用于XHTML文檔。 Get the html contents of the first matched element. This property is not available on XML documents (although it

html()
取得第一個匹配元素的html內(nèi)容。這個函數(shù)不能用于XML文檔。但可以用于XHTML文檔。
Get the html contents of the first matched element. This property is not available on XML documents (although it will work for XHTML documents).
返回值
String
示例
代碼如下:
HTML 代碼:
Hello
jQuery 代碼:
$("div").html();
結(jié)果:
Hello
html(val)
設(shè)置每一個匹配元素的html內(nèi)容。這個函數(shù)不能用于XML文檔。但可以用于XHTML文檔。
Set the html contents of every matched element. This property is not available on XML documents (although it will work for XHTML documents).
返回值
jQuery
參數(shù)
val (String) : 用于設(shè)定HTML內(nèi)容的值
示例
代碼如下:
HTML 代碼:
jQuery 代碼:
$("div").html("
Hello Again
");
結(jié)果:
[
Hello Again
]
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
jquery學(xué)習(xí)之二屬性(html()與html(val))_jquery
jquery學(xué)習(xí)之二屬性(html()與html(val))_jquery:html() 取得第一個匹配元素的html內(nèi)容。這個函數(shù)不能用于XML文檔。但可以用于XHTML文檔。 Get the html contents of the first matched element. This property is not available on XML documents (although it