I'm new to Javascript and am attempting to write a function that changes the color of some text, however "this" keeps returning as undefine, and not changing the text color. Here's the code, I would greatly appreciate some help.
<h1>
<ul><div class="info" id="info" onclick="this.style.color= '#9DC8BA'">INFO
</div></ul>
<ul><div class="menu" id="menu" onclick="test1()"<!--this is where the problem is-->MENU</div></ul>
Here's the Javascript
function test1() {
this.style.color= '#9DC8BA';
}
=test1()to=test1(this), andfunction test1()tofunction test1(div) {div.style.color='#CCC'}.