+ 6

JS - var.getAttribute()

Hello, I have been trying to replicate an exercise from a youtube video, but got to a point where it's not working the variable.getAttribute(). Could someone help me out? I have tried with save-on computer images and it also didn't work. But I would like to keep it as an external image linked to an http:// so I could leave it here as well. Is the code correct? What am I missing? It is still not finished, I only did it to the first condition to test (masculin, child). https://code.sololearn.com/WDr197p8LS03/#

17th Sep 2020, 11:48 AM
Jann Basso
Jann Basso - avatar
9 Réponses
+ 4
if (age>=0 && age<=10)... picture will be loaded
17th Sep 2020, 11:59 AM
Igor Kostrikin
Igor Kostrikin - avatar
+ 3
typo at condition Look at how I debug by adding console.log at line 48, 14 and then 26 https://code.sololearn.com/WRTUS9B4ddhx/?ref=app
17th Sep 2020, 11:58 AM
Gordon
Gordon - avatar
+ 3
Check this but i have change photo as it was taking time to load img for 2011 -2020 https://code.sololearn.com/WtccBhKN1ldu/?ref=app
17th Sep 2020, 1:21 PM
Divya Mohan
Divya Mohan - avatar
+ 2
Try to use correct conditions age>10 && age<=17 age>17 && age <65
17th Sep 2020, 12:48 PM
Igor Kostrikin
Igor Kostrikin - avatar
+ 2
thank you so much @Igor Kostrikin and @Divya Mohan! Now it's working for each and everyone :)
17th Sep 2020, 1:43 PM
Jann Basso
Jann Basso - avatar
+ 2
Jann Basso You should use console.log and view in DevTools Do you know how to open DevTool in browsers?
17th Sep 2020, 2:12 PM
Gordon
Gordon - avatar
+ 1
@Igor Kostrikin Thank you so much - that really helped! But now, trying to put the images on the other ones, it's not working as well. I tried changing the other conditions but still no good result. Do you see any other problems with the other numbers? Thank you!!
17th Sep 2020, 12:25 PM
Jann Basso
Jann Basso - avatar
+ 1
@Gordon Thank you!! I tried doing that, but it didn't work :( Are there any alternatives for "console.log"? And do you think the code I used was incorrect?
17th Sep 2020, 12:26 PM
Jann Basso
Jann Basso - avatar
0
thank you Gordon! Will do so :)
18th Sep 2020, 7:27 AM
Jann Basso
Jann Basso - avatar