0

Why js is not working when I put it on my file code

When I put the js code on my html file is not working I tried more than once and looked about spelling and it's true??

12th Dec 2019, 3:16 PM
Abdullah Adel
Abdullah Adel - avatar
9 Réponses
+ 1
There seem to be a couple things wrong - Firstly, you seem to have separated the string within the onclick event and the actual <button> tag, placing them on different lines, so if you just join them together it should be okay. As for the actual onclick event, the function you're trying to use should be document.getElementById, and rather than making html in innerHTML lowercase, try to keep it capitalized (like how I just typed it). The last thing is that you should try and avoid using double quotes inside single quotes, so rather than setting the innerHTML string within double quotes, set it within single ones ( ' ' )
12th Dec 2019, 3:57 PM
Faisal
Faisal - avatar
+ 1
What code are you having troubles with?
12th Dec 2019, 3:29 PM
Faisal
Faisal - avatar
+ 1
شكرا
12th Dec 2019, 3:59 PM
Abdullah Adel
Abdullah Adel - avatar
+ 1
The onclick attrib in html, should be returning a function... Eg <button onclick="functionName();">btnName</button> Js function functionName() { alert("nothing happened loool"); }
12th Dec 2019, 4:50 PM
Alfred Juma
Alfred Juma - avatar
0
Documents.getbyid() isn't work
12th Dec 2019, 3:33 PM
Abdullah Adel
Abdullah Adel - avatar
0
And others code
12th Dec 2019, 3:33 PM
Abdullah Adel
Abdullah Adel - avatar
0
Do you have the link to the code you're having troubles with? It'd be easier to help debug your program with a full understanding of what you're trying to do
12th Dec 2019, 3:35 PM
Faisal
Faisal - avatar
12th Dec 2019, 3:41 PM
Abdullah Adel
Abdullah Adel - avatar
0
This is👆🏻👆🏻👆🏻
12th Dec 2019, 3:42 PM
Abdullah Adel
Abdullah Adel - avatar