+ 4

how do i make the for each loop call the swap function when ever the blue button is clicked

note: the inbuilt IDE in sololearn does not recognise ...children(causing the cards to start from the 15th one), try running on personal ide to understand my question better https://code.sololearn.com/WITO1rlbovHf/?ref=app

27th Jan 2022, 3:14 AM
loop
loop - avatar
9 Respostas
+ 4
Solo's first reply is correct for the problem you're having with ...children, your code is trying to access the body of the document before is it is loaded. link below is quick read, it should help clear some up somethings https://www.sololearn.com/post/90825/?ref=app As far as your main problem the function swap is invoked when the blue button is clicked, the problem is with line 14. You need to change the logic of line 14 to include the skip button. https://code.sololearn.com/WKogRFAdof5c
27th Jan 2022, 6:38 AM
ODLNT
ODLNT - avatar
+ 3
First, your script needs to wait until the html document is fully loaded: onload=()=>{ // your code }
27th Jan 2022, 4:27 AM
Solo
Solo - avatar
+ 3
Yes, you have a lot of problems and you need to fix it one by one.
27th Jan 2022, 5:04 AM
Solo
Solo - avatar
+ 3
Not a problem, glad I was able to help.
27th Jan 2022, 6:54 AM
ODLNT
ODLNT - avatar
+ 2
ODLNT thank you so much
27th Jan 2022, 6:51 AM
loop
loop - avatar
0
Solo that's not the problem
27th Jan 2022, 4:58 AM
loop
loop - avatar
0
Ipang please help
27th Jan 2022, 4:59 AM
loop
loop - avatar
0
Solo i also tried that before bringing it here, didn't work... i think the problem is a combination of...wrong looping, wrong skip button selection & wrong way of calling the swap function on each of the skip button
27th Jan 2022, 5:35 AM
loop
loop - avatar
0
Solo if you got it to work please attach the code i'd like to see, thanks
27th Jan 2022, 5:36 AM
loop
loop - avatar