0

Do buttons trigger stuff?

I was testing code when I saw <button>. Can buttons trigger stuff in web language? And can it trigger stuff in games?

14th Jan 2020, 9:51 PM
XtremeMusicStudios Official
XtremeMusicStudios Official - avatar
5 Antworten
0
Yes, all you have to do is attach an onclick attribute to it, containing a Javascript function to run. For example: <button onclick="runFunction()"> However, I believe buttons are outdated, and what you should do is use a input tag: <input type="button" onclick="runFunction()">
14th Jan 2020, 9:58 PM
Jianmin Chen
Jianmin Chen - avatar
0
All you have to do is use the onclick attribute for button, and attach a function written in Javascript to it. A function is basically a block of code that can be reused. That's as simple as I can explain it. The button basically runs the function once it's been clicked, or "on"+"click"; this is done through the onclick attribute.
14th Jan 2020, 10:03 PM
Jianmin Chen
Jianmin Chen - avatar
0
You just place it in the button tag, like in my previous post.
15th Jan 2020, 9:53 PM
Jianmin Chen
Jianmin Chen - avatar
- 1
Explain it more simpler.
14th Jan 2020, 10:00 PM
XtremeMusicStudios Official
XtremeMusicStudios Official - avatar
- 1
What is the onclick and how do you do it,
15th Jan 2020, 9:51 PM
XtremeMusicStudios Official
XtremeMusicStudios Official - avatar