+ 3
hide a div if a condition
who can i hide a div if a condition is true
7 odpowiedzi
+ 10
you can try this:
document.getElementsByTagName ("div")[0].style.display ='none';
+ 5
window.onload=function(){
document.querySelector("div").style.display="none";
}
+ 2
@Muhd Khairul Amirin Bin Yaacob it didn't work this is the error Uncaught TypeError: Cannot read property 'style' of null
at window.onload
+ 2
@Muhd Khairul Amirin Bin Yaacob i do it bro thanks a lot but the problem now is the function is activated just one time because i have two table and 2 messages box .they switch every 5secondes with a toggle function .the message box is showen if the tables both have a "nok" in a column the message box show the name of the customers with status "nok". so when just one table have a "nok" the message box are hidden ; The function i create work but just one time .
this is my code
https://code.sololearn.com/WD31Xd33L846/#html
and thanks a lot