网站数据库备份还原,网络营销策划书5000字,怎么做农家乐联盟网站,平台手机端网站开发html(val)方法获取第一个匹配元素的html内容(innerHTML)。此属性在XML文档上不可用。
html( ) - 语法
selector.html( )
html( ) - 示例
以下是一个简单的示例#xff0c;简单说明了此方法的用法-
htmlheadtitleThe jQuery Example/title简单说明了此方法的用法-
htmlheadtitleThe jQuery Example/titlescript typetext/javascript srchttps://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js/scriptscript typetext/javascript languagejavascript$(document).ready(function() {$(div).click(function () {var content$(this).html();$(#result).html(content);});});/scriptstyle.div{ margin:10px;padding:12px; border:2px solid #666; width:60px;}/style /headbodypClick on any square below to see the result:/pp idresult THIS IS TEST /pdiv classdiv stylebackground-color:blue;h1This is square one /h1/divdiv classdiv stylebackground-color:green;h1This is square two /h1/divdiv classdiv stylebackground-color:red;h1This is square three /h1/div/body
/html
这将产生以下输出- 参考链接
https://www.learnfk.com/jquery/dom-html.html