Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
153
rated 0 times [  155] [ 2]  / answers: 1 / hits: 35824  / 14 Years ago, tue, december 7, 2010, 12:00:00

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.


More From » onclick

 Answers
19

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 :)


[#94690] Monday, December 6, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
turnerf

Total Points: 620
Total Questions: 101
Total Answers: 109

Location: French Polynesia
Member since Tue, Jul 7, 2020
4 Years ago
turnerf questions
;