Background image not displaying

The value of obj.backgroundImage is url(/images/apple.jpg)

and the background-image style appears as url(“/images/apple.jpg”)

The background-image style should be url(/images/apple.jpg) not url(“/images/apple.jpg”). And when I tried changing the path to url(/imgs/apple.jpg), the background-image style appeared as url(“/imgs/apple.jpg”).


The property is background-image, not backgroundImage. You should do["background-image"] = 'url("/imgs/apple.jpg")';.

I’ll try it. Thanks in advance

It doesn’t work. Image doesn’t appear, though the style appears on the element.

Hey @OmegaOrbitals2,

could you send the link to your repl?

It’s part of a programming language, you may find it pretty complicated :sweat_smile:

I’ll take a look at it and see what I can do!

The link has been removed.

In which file is your error you need help with located?

Edit : Found it

You haven’t updated line 136 of magma/magma.js. This is important because only styles applied to thestyle property before the object is appended to the DOM will work. (Setting thestyleattribute is different.)

Updated it, image still doesn’t show

Hmm, that’s odd, I’ll come back to this in a little bit and check it out on my PC (I’m on my phone right now so I don’t have access to proper dev console).

1 Like

Change line 14 for this :

apple.edit("backgroundImage", `url(/images/apple.jpg)`);
1 Like

Works perfectly for me! I asked ChatGPT to confirm if it was correct and then I realized it was correct since I used `` in other JS projects!


The backticks won’t change anything, the lack of words around the url might do it though.

Hmm, this is really strange. This is a tough one!


No, doesn’t work. Maybe it’s a replit bug?


Not possible, JS runs in your browser.


I doubt that, I’m not an expert on JS, but if you wait a little bit more, I’m sure more people will hop on the topic!


What do you expect to see as an output?

1 Like