JS - var.getAttribute() | SoloLearn: Learn to code for FREE!

+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/#

9/17/2020 11:48:26 AM

Jann Basso

9 Answers

New Answer

+4

if (age>=0 && age<=10)... picture will be loaded

+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

+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

+2

Try to use correct conditions age>10 && age<=17 age>17 && age <65

+2

thank you so much @Igor Kostrikin and @Divya Mohan! Now it's working for each and everyone :)

+2

Jann Basso You should use console.log and view in DevTools Do you know how to open DevTool in browsers?

+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!!

+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?

0

thank you Gordon! Will do so :)