My JavaScript code is:
var headline = document.getElementById("mainHeading");
headline.onClick = function() {
headline.innerHTML = "You clicked the headline.";
};
But nothing happens when I click the headline. It just works when I use onclick
instead of onClick
(without capital letter C).
The thing is when I debug with both Chrome DevTools and Firebug, they don't show onClick
as a syntax error.
Could anyone tell me how to debug it?