0

JavaScript problem

Hello anyone. I use js methods “document.querySelector(‘something’) or document.getElementById(‘id’)” but these do not work here. I tried change it. In my opinion I do not know a secret. Can you help me, please?

22nd Jan 2019, 12:07 PM
Сергей Владимиров
Сергей Владимиров - avatar
4 ответов
+ 2
You need to tell javascript to perform the action "onload" you can use : window.onload = () => { //codes here }
22nd Jan 2019, 12:25 PM
kaan
kaan - avatar
0
damn problem. Try it yourself please. https://code.sololearn.com/W3cElWWJTIiG/?ref=app
22nd Jan 2019, 6:24 PM
Сергей Владимиров
Сергей Владимиров - avatar
0
variable on line 6 defined. Try to use it anyway
22nd Jan 2019, 6:29 PM
Сергей Владимиров
Сергей Владимиров - avatar
0
you can try this HTML: <html> <head> <title>generator of password</title> </head> <body> <div> <p> choose parameters and push a button below </p> <input id="spec" type='checkbox'>special symbols <br> <input id="num" type='checkbox'>numbers <br> <input id="alphabet" type='checkbox'>alphabet <br> <button type='button' onClick="try1()">DO IT!!</button> <p><strong id='result'></strong></p> </div> </body> </html> JS: function try1(){ console.log("try1") }
22nd Jan 2019, 6:38 PM
kaan
kaan - avatar