OK I have:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript index</title>
</head>
<body id="body">
<p id="para">Hello I am Sam</p>
<script>
"use strict";
var element = document.getElementById("para");
element.addEventListener( "click", function(color){
this.style.backgroundColor = color;
}, false );
</script>
</body>
</html>
My main question is with regards to:
element.addEventListener( "click", function(color){
this.style.backgroundColor = color;
}, false );
Is there a way to dynamically pass in a color or does it have to be hard coded?