I've noticed that the questions already posted do not solve my issue. I have a side menu bar displaying options and I want the content of the selected option to be displayed on the same page, while hiding the other div content. I have tried the following code, but it doesn't seem to work:
$('a.common').click(function() {
var id = $(this).attr('href');
$(id).fadeIn('slow', function() {
// Animation complete
});
});
<div id="container">
<div id="canvas">
<div id="nav">
<h2 id="title">
<i class="fa fa-sitemap">
</i> MENU</h2>
<ul id="toggle">
<li>
<div class="active border">
<a href="#div1" class="common">HOME</a>
</div>
</li>
<li>
<div>
<span class="menu-icons fa fa-user"></span>
<a href="#div2" class="common">ABOUT US</a>
</div>
</li>
<li>
<div>
<a href="#div3" class="common">PORTFOLIO</a>
</li>
<li>
<div>
<a href="#">CONTACT</a>
</div>
</li>
</ul>
</div>
<a href="#" class="toggle-nav" id="bars"><i class="fa fa-bars"></i></a>
<div id="div1">TEST ONE</div>
<div id="div2">TEST TWO</div>
<div id="div3">TEST THREE</div>
</div>
</div>