0

Yall im confused! What is "class=onClick"???

23rd Aug 2020, 11:35 PM
Aden King
Aden King - avatar
2 Réponses
+ 2
I would be confused too if I saw class=onclick somewhere. Can you share a larger snippet of code or a link to a tutorial or article showing this? In HTML, class is an attribute that is often used for CSS styles. onclick can be used to run specified JavaScript when someone clicks an element. To keep JavaScript more independent from HTML, the onclick attribute is often replaced with other ways to bind event handlers in JavaScript. These other ways include jQuery's on, bind, click, methods or JavaScript's addEventListener method. class=onclick doesn't make sense in any language I know of. Someone could name a CSS class 'onClick' but the only thing that'll accomplish is confusing people. It would be like naming a variable 'void' or 'if'.
24th Aug 2020, 3:09 AM
Josh Greig
Josh Greig - avatar
0
Thank you for your help Josh!
25th Aug 2020, 7:58 PM
Aden King
Aden King - avatar