Javascript change Div style

javascript

Solution

function abc() {
    var color = document.getElementById("test").style.color;
    if (color === "red")
         document.getElementById("test").style.color="black";
    else
         document.getElementById("test").style.color="red";
}

Problem

I want that `part 1` onclick div style changes and `part 2` again on click it comes back to normal. I tried doing so but I failed to achieve the `part 2` results. Following is the Javascript code ``` function abc() { document.getElementById("test").style.color="red"; } ``` After clicking the test div again, color should come back to defaulr color i.e. black...

Original source