Have got an button in nav, which on click event is supposed to display:block an ul which is initially set to display:none
HTML -
<a href=""><i class="mdi-navigation-menu small right" id="lines3"></i></a>
</nav>
<ul class="collection center" id="drop-navv" style="display:none">
<li class="collection-item">Alvin</li>
<li class="collection-item">Alvin</li>
<li class="collection-item">Alvin</li>
<li class="collection-item">Alvin</li>
</ul>
Js -
$(document).ready(function() {
$('#lines3').on('click', function() {
$("#drop-navv").css("display", "block");
});
// other click event
});
But as soon as I click button it works, but immediately page get reloaded! Its been hours but still cannot figure out why its happening!! PS: Am using materialize framework. And other click event as mentioned in comment is working.
You're going to need to prevent the default on your click handler.
So, first I'd change the
href
to behref='#'
and then add this.This will prevent the link from going anywhere when someone clicks it.