我需要知道你会如何调用document.body.innerText;和document.body.innerHTML;在 jQuery 中。jQuery如何处理以document.body开头的javascript方法...
谢谢
我需要知道你会如何调用document.body.innerText;和document.body.innerHTML;在 jQuery 中。jQuery如何处理以document.body开头的javascript方法...
谢谢
// document.body.innerText;
$('body').text();
//document.body.innerHTML;
$('body').html();
使用$('body')或$(document.body)选择主体。然后你可以使用.text()and.html()来获取相关内容。
$("id/class/name/document")是选择,您可以使用(innerhtml html()) 和text()(innertext ) 到那里的内容。
1-文本()
<div class="demo">Demonstration Box</div>
The code $('.demo').text() would produce the following result:
这是选择--^^^^^^^ ^^^^^^---上课内容demo
输出:
Demonstration Box
2- html()
<div class="demo"><p>Demonstration Box</p></div>
$("input").html("text"); will change the---^^^^^^^^^^^^^^^^^---to text
$('body').text(); // innertext
$('body').html();//innerhtml