Answer the question
In order to leave comments, you need to log in
Why JS code doesn't work on Flask?
Hello, I have a problem with js code not working correctly on Flask.
The js itself works as it should, but if you run the site through Flask, then the js starts to work not as it should, for example, the buttons stop working. For example, here is a simple js function that opens/closes modal windows:
function switchPopup(popupToClose){
if(popupToClose.style.display == "flex")
popupToClose.style.display = "none";
else
popupToClose.style.display = "flex";
}
function switchPopup(popupToClose){
if(popupToClose.style.display == "flex")
popupToClose.style.display = "none";
else
alert("test");
popupToClose.style.display = "flex";
}
Answer the question
In order to leave comments, you need to log in
I forgot to add curly braces, now your code works like this
if(popupToClose.style.display == "flex"){
popupToClose.style.display = "none";
}else{
alert("test");
}
popupToClose.style.display = "flex";
popupToClose.style.display
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question