Tell us what’s happening:
What’s wrong with my else block? The code it uses is exactly the same as I used in onload().
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: index.ts */
// User Editable Region
onload="this.classList.remove('hidden');this.previousElementSibling.style.display='none';"
onerror="() => {
if (!this.dataset.failed) {
this.dataset.failed = '1';
this.src = "${LOCAL_DEFAULT_IMG}";
} else {
this.classList.remove('hidden');
this.previousElementSibling.style.display = 'none';
}
}
// User Editable Region
These are the errors I get:
5. You should have an else block should that removes the hidden class. Don't forget the this keyword here.
6. Your else block should set previousElementSibling.style.display to 'none'. Don't forget the this keyword here.
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36
Challenge Information:
Build a Fortune Telling App - Step 15