jQuery
没有innerText
属性,修改文本是$("#log").text("要替换的文本")
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Title</title>
<style>
#log {
border: 1px solid black;
width: 200px;
height: 200px;
}
</style>
</head>
<body>
<div id="log"></div>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$(function () {
document.getElementById("log").innerText += "JQuery";
console.log('$("#log").innerText', $("#log").innerText)
$("#log").text($("#log").text() + "JQuery");
});
</script>
</html>