คุณสมบัติ nodeValue ใช้เพื่อรับค่าโหนด คุณต้องระบุโหนด
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อเรียนรู้วิธีรับคุณสมบัติ nodeValue
<!DOCTYPE html> <html> <body> <p>Get the node value</p> <button>Demo Button Text</button> <script> var val = document.getElementsByTagName("BUTTON")[0]; var res = val.childNodes[0].nodeValue; document.write("<br>Node Value: "+res); </script> </body> </html>