onclick or onClick?

javascript, onclick

Solution

Because some browsers (depending on the DOCTYPE) are tolerant of the inline `onClick="something();"` attribute...it seems to have spread a bit, even into JavaScript questions where it doesn't work, since case matters.

Also, specifically to stackoverflow...people using it in questions...well, most of the time they wouldn't be asking a question if their code worked :)

Problem

I thought that binding the click event in javascript is done by using `node.onclick`, and Chrome/Firefox seem to agree with me, but I saw it written `.onClick` here 4 times by 3 people, so it can't be a typo and I doubt that it's a coincidence. So, why are people writing `onClick` when it does not work? UPDATE: There are two good explanations; I don't know which one of them is the most plausible, so I will accept the answer based on popular vote, tomorrow.

Original source