Hi,
I am trying to console.log a simple message when any paragraph is clicked,
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p id="bob">This is a paragraph</p>
<p>This is one too a paragraph it is!</p>
<script>
function changepcolor() {
console.log("I pushed a button!");
}
// var Para = document.getElementById("bob"); // this works when uncommented
var Para = document.getElementsByTagName("P"); //this doesn't work
Para.addEventListener("click", changepcolor, false);
</script>
</body>
</html>
In the console I get this error,
Uncaught TypeError: Para.addEventListener is not a function
Thanks