The behavior of the executable file differs from that of the live server

16 views Asked by At

Hi i'm relatively new to coding, particularly in Electron. I've organized my project into different folders with various files. When I use a live server, everything functions correctly. However, upon starting the code with 'npm run start' a specific part fails to work properly. I'm attempting to change the color with a click using the function change_color(), but unfortunately, it's not working as intended.

# Karteikarten.html

function change_color() {  
  const karteikartenElement = document.querySelector('.Karteikarten');  
  karteikartenElement.style.backgroundColor = 'lightblue';  
}  

# Ergänzung.js  

<div class="Karteikarten" onclick="change_color()">  
         <p>Karteikarten</p>  
    </div>  

Folderstructure

enter image description here

I need an explanation:)

0

There are 0 answers