How to hide a div?

I’ve been trying to hide a div with no luck. Here’s what I’ve got:

if ( window.location !== window.parent.location ) {
document.getElementById(promo).style.display = "none"; 
} else {
<div id="promo">Stuff here</div>

It should work!?

Hi @Freejoy, you might need to wrap promo in quotes inside getElementById

I just tried it with single and double quotes, still didn’t work. It works with document write so the if statement works.

Oh yeah maybe try to put your script after the HTML and keep the quotes


I put all my javascript right before the ending body element →

<footer class="footer-style">
    <p class="footer-name">&copy;<?php echo date("Y"); ?> <span>John R. Pepp</span></p>
<script src="assets/js/mobile-nav.js"></script>
<script src="assets/js/sticky.js"></script>
<script src="assets/js/slideshow.js"></script>
<script src="assets/js/GoogleAnalytics.js"></script>
<script src="assets/js/privacy.js"></script>
    if ($basename === 'blog.php') {
        echo '<script src="assets/js/blog-user-selection.js"></script>';


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.