Javascript examples for DOM:Element innerText
InnerText vs textContent on an element
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> var textContent = ('textContent' in document) ? 'textContent' : 'innerText'; window.onload = function () {// w w w.ja va 2 s. c om console.log(document.getElementById('test')[textContent]); } </script> </head> <body> <div id="test"> Test </div> </body> </html>