How to skip alt= attribute situationÔüë´ŞĆ HTML <img src= ... alt= ... /> [FIXED] | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 5

How to skip alt= attribute situationÔüë´ŞĆ HTML <img src= ... alt= ... /> [FIXED]

My code displays random SoloLearn Avatars. But when the generated avatar address is incorrect & the avatar cannot be loaded, the alt= attribute is activated. In this case, I would like to jump to generating a new, correct address and displaying the next avatar. In ­čÉŹ I solved this problem by using: try: except: How to avoid this situation in web codeÔüë´ŞĆ­čĄö I'm not an expert in "The Holy Trinity", HTML+CSS+JSÔÇ╝´ŞĆ­čśĽ https://code.sololearn.com/WXEmMRkrNa89/?ref=app https://code.sololearn.com/caW7TeDOLM6W/?ref=app

21st Feb 2022, 10:45 AM
Janusz Bujak ­čçÁ­čç▒ ­čç║­čçŽ
Janusz Bujak ­čçÁ­čç▒ ­čç║­čçŽ - avatar
7 Antworten
+ 4
Add onerror="next()" to the image tag
21st Feb 2022, 3:32 PM
ODLNT
ODLNT - avatar
+ 6
ODLNT You are GeniusÔÇ╝´ŞĆ onerror='next()' worksÔÇ╝´ŞĆ Thx a lotÔÇ╝´ŞĆÔś║´ŞĆ
21st Feb 2022, 8:15 PM
Janusz Bujak ­čçÁ­čç▒ ­čç║­čçŽ
Janusz Bujak ­čçÁ­čç▒ ­čç║­čçŽ - avatar
+ 3
ODLNT Does "download" attribute of hyperlink work in SoloLearn? I tried to wrap the image in a hyperlink with "download" attribute but it opens up the browser instead of allowing the file to be saved ... https://code.sololearn.com/W0856YcmseVM/?ref=app
21st Feb 2022, 4:35 PM
Ipang
+ 3
Ipang According to MDN the download attribute on sololearn app is working as it should, it appears the user must download from a browser instead of the webview. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download
21st Feb 2022, 6:30 PM
ODLNT
ODLNT - avatar
+ 3
Genius?! ...I'll take it­čśü. I'm glad I could help.
21st Feb 2022, 10:20 PM
ODLNT
ODLNT - avatar
+ 2
Thank you ODLNT ­čÖĆ
21st Feb 2022, 6:35 PM
Ipang
- 5
K ckx xkzklo oo lh,ox see lll
22nd Feb 2022, 8:56 PM
Luna Michelle Velasquez Bocanegra