0
Yall im confused! What is "class=onClick"???
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'.
0
Thank you for your help Josh!