I want to change the color of the text using the javascript function but nothing happens when I click on the button. The files are in the same folder.
function click() {
document.getElementById('test').style.color = "red";
alert("hello");
}
<p id="test">Hello world</p>
<button type="button" onclick="click()">hello</button>