0
Help with InnerHTML
2 Respostas
+ 3
document.getElementsByTagName('p')[0].innerHTML
0
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<script>
function change(){
document.getElementsByTagName("p")[0].innerHTML = 'yay! you did it!';
}
</script>
</head>
<body>
<p>cookie monster eats cookies.</p>
<button onclick='change()'>change the sentence above</button>
</body>
</html>