Use the getElementsByTagName method to find the <p> element, and change its text to "yes". - Javascript DOM

Javascript examples for DOM:Quiz

Description

Use the getElementsByTagName method to find the <p> element, and change its text to "yes".

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p>Use the DOM to change my text!</p>

<script>
document.getElementsByTagName("p")[0].innerHTML = "yes";
</script>/*from   w w  w .  j  av a  2  s. com*/

</body>
</html>

Related Tutorials