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
backgroundImage. You should do
HTMLElement.style["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.
could you send the link to your repl?
It’s part of a programming language, you may find it pretty complicated
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 the
style property before the object is appended to the DOM will work. (Setting the
styleattribute 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).
Change line 14 for this :
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?