innerText in js

value is the attribute value of the element, while innerText and innerHTML are the values ​​between the element's start and end tags .

E.g:

<html>
<head>
<script type="text/javascript">
function show(obj){
alert(obj.value);//输出value
}
function showD(obj){
alert(obj.innerText);//输出innerText
}
</script>
</head>
<body>
<div onclick="showD(this)">innerText</div>
<input type="button" value="value"onclick="show(this)"></input>
</body>
</html>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326549491&siteId=291194637