<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<p>
skateboarding
sdsds
abc
</p>
</body>
</html>
var p = document.querySelector('p');
var innerHTML = p.innerHTML;
var innerText = p.innerText;
var textContent = p.textContent;
var elem = p.childNodes;
for (var i = 0; i < elem.length; i++) {
if (elem[i].nodeType === 3) {
console.log(elem[i]);
}
}
网友评论