textContent 屬性可以用來取得 / 設定元素和子孫元素的內容
textContent1.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<ul id="foods">
<li id="one">珠寶盒</li>
<li id="two">法朋</li>
<li id="three">Lady M</li>
<li id="four">RAW</li>
</ul>
<script src="textContent1.js"></script>
</body>
</html>
textContent1.js
var item = document.getElementById('one');
document.write('項目:' + item.textContent);