+ 1
Itâs a lost question but I am new
How do I make a buton that does something
5 Answers
+ 2
What are you trying to do? You can (assuming you are using HTML) use <input type=âsubmitâ> to create a button that submits a form, or a <button> with an onclick event attribute to trigger an action using JavaScript. How to implement the action (handling a form, changing something on the page, or something else) will depend on what your goal is.
+ 1
There are some different ways to make a button do something in Web development.
1: Using the onclick attributes: (Syntax: onclick = "JS_function_name()") This attribute would trigger a specific function once the element with this attribute is clicked. There are many other attributes with familiar functionality such as: onchange, onfocus..(correct me if I'm wrong)
2. Using JS: In JS, you can give it more functionality than just one function like the onclick ones. This can be done by using addEventListener(), click(), on(), and some more. [The on() function only available in jQuery]
0
Thanks
0
Thanks
0
use <button> attribute to make a button