Build a Fortune Telling App - Step 15

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

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-fortune-teller-app/68e420817107eb7cb2d4d4d6.md at main · freeCodeCamp/freeCodeCamp · GitHub

make sure you are closing the string, it does not look closed from the code you have shared

I still have the same problem

onerror="() => {
            if (!this.dataset.failed) {
              this.dataset.failed = '1';
              this.src = "${LOCAL_DEFAULT_IMG}";
            } else {
              this.classList.remove('hidden');
              this.previousElementSibling.style.display = 'none';
            }
          }"

the string ends here

maybe don’t use double quotes here?