Having trouble adding background-image with JS...

const navHeader = document.querySelector(".nav-header")

navHeader.style.backgroundImage="url('images/desktop-image-hero-2.jpg');";
const navHeader = document.querySelector(".nav-header")

navHeader.style.backgroundImage="url('images/desktop-image-hero-2.jpg');";
JS file and HTML file are located in main folder, while image is in images folder, as shown in URL, so just a folder away from them.
5 Replies
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Dovah
DovahOP•2y ago
@trrapp Nothing. I can send you the project link if you want to look at it yourself. It's small project so should not be hard to check it.
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Coder_Carl
Coder_Carl•2y ago
I'm more worried about the ; tbh
Dovah
DovahOP•2y ago
Kay let me try them @Coder_Carl Yup xD Such a silly mistake, yet wasn't able to see it been losing my mind over it Thanks for the help! 😄
Want results from more Discord servers?
Add your server