Sometimes I see in the tag input an attribut like onclick how does it work? Where can I have the lists of events like onclick ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Sometimes I see in the tag input an attribut like onclick how does it work? Where can I have the lists of events like onclick ??

Events

2nd Apr 2018, 7:15 AM
Armel
Armel - avatar
4 Answers
2nd Apr 2018, 11:29 AM
visph
visph - avatar
+ 1
Adam if I want to write a function in js will the code above be appropriate ??
3rd Apr 2018, 8:24 AM
Armel
Armel - avatar
0
<span onclick="alert('hello');">Click</span> would alert hello when you click it. <span onclick="sayHello();">Click</span> would run the function sayHello and execute whatever it contained. here is a list of common events as they are called. https://www.w3schools.com/js/js_events.asp
2nd Apr 2018, 7:22 AM
Adam
Adam - avatar
0
yes. those will work.
3rd Apr 2018, 6:58 PM
Adam
Adam - avatar