0

I have to hide one web part on page or whole page (whatever I find quicker) on every Friday. I was sure javascript code will work, but it still shows web part.

window.addEventListener("load", function(){
 var currentDay = new Date();
 var day = currentDay.getDay();
 var hideMe = document.getElementById("MSOZoneCell_WebPartWPQ3");  
 /* This is web part that I need to hide */

if(day=3) { /* I put 3 for today to check if it will work, but I need Friday as a day */
 hideMe.style.display = "none";          
}
else {
 hideMe.style.display = "block";
}
}, false);

1 Answer 1

2

In your If statement - compare the values as below (double '=' instead of single '='):

if(day==3) { /* I put 3 for today to check if it will work, but I need Friday as a day */
 hideMe.style.display = "none";          
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.