+ 1
JavaScript DOM manipulation, help with my code
I can't get my code to work. I checked all the bugs, idk if i missed something and I can't find what is wrong. Pleas Help https://code.sololearn.com/W58eb61krZ81/?ref=app
14 ответов
+ 4
I have coded demo #4 to #6 today.
https://code.sololearn.com/WSYhP71671nP/?ref=app
If you don't understand anything, go through the supplementary materials; after that if you still don't understand, do let me know.
+ 2
Beginning with this, there should be 5 to 6 parts.
https://www.sololearn.com/post/129437/?ref=app
+ 2
You are welcome. I will post on alternate days, for example, Monday then Wednesday then Friday. Please follow everything.js page to read the next lessons. If you don't understand anything, leave a comment there; if you understand it, please also leave a comment, so I can know. Please tag me when you are asking question because I don't read notifications of everything.js page.
+ 1
the error message of "q2 is not defined"
is referring to line 54
eval('q'+ i)[j]
here in for loop, in the first iteration when i =0, it evaluates q1 and it is fine. at second iteration when i = 1, it evaluates q2 which doesn't exists.
you don't need eval("q" + i) here, just q1.
also in html, for the onsubmit attribute of form, no return, just call the function.
+ 1
here is the first phase of correction for you, in which there is one question and the alert message appears after clicking submit button.
https://code.sololearn.com/WDYicBhO3rk2/?ref=app
if you want to add fixed number of question, you need to declare the array in global scope just like how you declare q1 at the top of js tab.
if you want to add a variable number of question, you need to use a more complex data structure, an array of array or an array of object.
if the question are in html elements, use the same class name, and use getElementsByClassName to count the number of questions.
if the question are in a data, use createElement and appendChild to generate the html elements.
+ 1
in simple words, don't use form, which is related to PHP server-side handling.
i could code examples for you little by little, so you can understand.
this could benefit many sololearners.
let's put this in everything.js as our next daily tutorial series.
0
ok, I am away from my lap top, thanks, I will tinker with that later. How will it iterate if I add more questions, or is the line 54 for 2 or more questions?
0
ok thanks, Really awsome, I am berly getting the hang of this,
0
YES
THANKS
0
I want to practice this, because I want to make an offline app for myself and others. Thats kinda how I learned, programming, with a python quiz app which is no longer available on google play. I figured that this js skills could transfer to other programming languages
0
Soo.... yes please make some good sample codes I would really Like that.
0
Thanks
0
sounds like a plan, I went over some code and saved it that i got from you games code I dont have questions over it but I will post it here, I kinda saw and understand the structures. I want to know these codes by heart so that I can post them on my Real Life Portfolio On Git Hub. I think I am ready to start my programming career as a front end web page develper and then move up the scale.
https://code.sololearn.com/WVJh3NtNjMzi/?ref=app this is not my code, and if neccesary I will post a link to it later, I kinda busy right now. But seriously thanks, for expleaining to me my coctail quiz code
0
do you have time to go over this code ?????????????
https://code.sololearn.com/WY30ZJRVmSYO/?ref=app