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

Javascript examples for DOM:Quiz

Description

Use the getElementsByClassName 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 class="test">Use the DOM to change my text!</p>

<script>
document.getElementsByClassName("test")[0].innerHTML = "yes";
</script>//w w  w  .  ja  va 2s  .  co m

</body>
</html>

Related Tutorials