Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

semicolon is expected. | document.body.style.background.image = “

function toggle() {
     document.body.style.background.image = `
     linear-gradient(
      210deg,
      hsl(0deg 0% 0%) 0%,
      hsl(137deg 0% 1%) 0%,
      hsl(137deg 0% 2%) 0%,
      hsl(137deg 0% 4%) 2%,
      hsl(137deg 0% 5%) 5%,
      hsl(137deg 0% 5%) 10%,
      hsl(137deg 0% 6%) 19%,
      hsl(137deg 0% 6%) 42%,
      hsl(261deg 17% 14%) 88%,
      hsl(259deg 25% 27%) 97%,
      hsl(258deg 28% 40%) 100%,
      hsl(258deg 36% 54%) 100%
    );`;
  }

I am getting an error saying ; is expected.

I don’t know why it does not work.

I tried putting background.image and the error ‘;’ is expected would go away.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Its backgroundImage, not background.image

function toggle() {
    document.body.style.backgroundImage = `
    linear-gradient(
      60deg,
      hsl(0deg 0% 0%) 0%,
      hsl(137deg 0% 1%) 0%,
      hsl(137deg 0% 2%) 0%,
      hsl(137deg 0% 4%) 2%,
      hsl(137deg 0% 5%) 5%,
      hsl(137deg 0% 5%) 10%,
      hsl(137deg 0% 6%) 19%,
      hsl(137deg 0% 6%) 42%,
      hsl(261deg 17% 14%) 88%,
      hsl(259deg 25% 27%) 97%,
      hsl(258deg 28% 40%) 100%,
      hsl(258deg 36% 54%) 100%
    )
    `;
  }

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading