jQuery---html方法和text方法

html方法和text方法

 

      //html:innerHTML  text:innerText
      console.log($("div").html());//<h3>我是标题</h3>
      console.log($("div").text());//我是标题

 

 

$("div").text("<p>我是文本</p>");

 

 

$("div").html("<p>我是文本</p>");

posted @ 2020-01-19 16:22  jane_panyiyun  阅读(283)  评论(0编辑  收藏  举报