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 AMJann Basso
9 AnswersNew Answer
if (age>=0 && age<=10)... picture will be loaded
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
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
Try to use correct conditions age>10 && age<=17 age>17 && age <65
thank you so much @Igor Kostrikin and @Divya Mohan! Now it's working for each and everyone :)
Jann Basso You should use console.log and view in DevTools Do you know how to open DevTool in browsers?
@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!!
@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?
thank you Gordon! Will do so :)