If a div exist hide another div [on hold]

i have this code:

<nav id=”top-menu-nav”>
<ul id=”top-menu” class=”nav”>
<li id=”menu-item-6509″ class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-home current-menu-item page_item page-item-38 current_page_item menu-item-6509″><a href=””>button0</a></li>
<li id=”menu-item-6512″ class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-6512″><a href=””>button1</a></li>
<li id=”menu-item-6510″ class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-6510″><a href=””>button2</a></li>
<li id=”menu-item-6604″ class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-6604″><a href=””>button3</a></li>
<li id=”menu-item-6826″ class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-6826″><a href=””>button4</a></li>
</ul>
<div id=”rounded-button” class=”rounded-button”>
<a href=””>button5</a> – OR – <a href=””>button6</a>
</div>
</nav>

i’ve added this javascript in header.php and is not working:

<script type=”text/javascript”>
$(document.ready(function () {
if ($(“#menu-item-6826”).length > 0) {
$(“#rounded-button”).show();
} else {
$(“#rounded-button”).hide();
}
}));
</script>

I want when div id=#menu-item-6826 is on the page, the div id=#rounded-button to be hidden.Div id=#menu-item-6826 is appear on the page only when user is login.

Read more here:: If a div exist hide another div [on hold]

Leave a Reply

Your email address will not be published. Required fields are marked *