Can 1 button have 2 functions? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

Can 1 button have 2 functions?

For example, 1 button has a function to save data and print receipts When clicking the button it immediately displays the receipt but the data is also stored in the table I saw on Google, 1 button can have 2 functions, but I don't know if it can work like this too I haven't tried it yet, because jreport/struct isn't working yet, still error, can't use jreport( receipt ) Please let me know, or if it doesn't work like this, please give me a suggestion This is about ordering a photo package (photography studio)

22nd Jun 2023, 10:42 PM
Nasywa
2 Respostas
+ 6
You can call many functions on a event of single button.
23rd Jun 2023, 2:59 AM
AĶ¢J
AĶ¢J - avatar
+ 1
You can add multiple event listeners to any element programmatically use the addEventListener method button.addEventListener("click",func1); button.addEventListener("click",func2); on click of button both func1 and func2 will be called
23rd Jun 2023, 5:26 AM
Virtual Pixel || good bits
Virtual Pixel || good bits - avatar