Onclick event in js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Onclick event in js

I had create a calculator. I want to use onclick event to enter number in input screen by just clicking button but I couldn't create perfect logic in function.plz help me to solve it out. https://code.sololearn.com/W8zqhePpIHw3/?ref=app

22nd Sep 2018, 1:45 PM
Abhishek Shailendra Khandare
Abhishek Shailendra Khandare - avatar
7 Answers
+ 2
thx estifanos tekiea
23rd Sep 2018, 4:30 AM
Abhishek Shailendra Khandare
Abhishek Shailendra Khandare - avatar
+ 1
use the dis function on js in this code https://code.sololearn.com/WKc1bJvyiEq1/?ref=app
22nd Sep 2018, 2:22 PM
estifanos
estifanos - avatar
+ 1
event listeners? ?
23rd Sep 2018, 4:31 AM
Abhishek Shailendra Khandare
Abhishek Shailendra Khandare - avatar
+ 1
thx LogoMonic
23rd Sep 2018, 9:28 AM
Abhishek Shailendra Khandare
Abhishek Shailendra Khandare - avatar
0
it is probably better to add event listeners in your js file
22nd Sep 2018, 11:20 PM
Logomonic Learning
Logomonic Learning - avatar
0
Alternatively you could use a for loop to detect all buttons being clicked, in a few lines like so.. https://code.sololearn.com/WSEeKw3LvPWN/#html
23rd Sep 2018, 9:15 AM
Logomonic Learning
Logomonic Learning - avatar
0
yw
23rd Sep 2018, 9:46 AM
Logomonic Learning
Logomonic Learning - avatar