Can anyone tell me why it is not working as I am new in js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone tell me why it is not working as I am new in js

https://code.sololearn.com/WA19A2a25A21/?ref=app

24th Jul 2021, 5:35 AM
Harshita Kumari
Harshita Kumari - avatar
8 Answers
+ 3
You have declared document.getElementById("btn") .addEventListener("click", function () {...} In the line 47.So you must declare the id="btn" in that specific button to get access with that button. Here's a demo example: https://code.sololearn.com/WoBkijJ2shIs/?ref=app
24th Jul 2021, 6:49 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
It's working fine in my device. What's wrong on your side?
24th Jul 2021, 6:09 AM
Rohit Kh
Rohit Kh - avatar
+ 1
which line you have declared the btn id in your code html ?
24th Jul 2021, 6:34 AM
The future is now thanks to science
The future is now thanks to science - avatar
0
A͢J it's not working on pc
24th Jul 2021, 6:23 AM
Harshita Kumari
Harshita Kumari - avatar
24th Jul 2021, 6:26 AM
Harshita Kumari
Harshita Kumari - avatar
0
The future is now thanks to science[In a break] I had not declared it I just wrote button type button there and in the slider I had declared only button onlick
24th Jul 2021, 6:45 AM
Harshita Kumari
Harshita Kumari - avatar
0
Harshita Kumari Why you didn't share original code? It is your mistakes not our. Your previous shared code was working fine. You still have many mistakes. There is no id 'btn' and 'text'
24th Jul 2021, 7:00 AM
A͢J
A͢J - avatar