Thank you Ganesh "onclick ="return false;" works :D
So i made a onclick dropdown menu with this tutorial: clickable dropdown menu. The problem is that when i click the button to open the dropdown menu the website refreshes. How can i change that?
Here's the HTML:
<div id="menuebutton">
<ul class="no-js">
<li>
<a href="" class="clicker"><img src="files/KH-Homepage/menue_button.png" alt="Icon"></a>
<ul>
<li><a href="#">Dashboard</a></li>
<li><a href="#">Settings</a></li>
<li><a href="#">Privacy</a></li>
<li><a href="#">Help</a></li>
<li><a href="#">Sign out</a></li>
</ul>
</li>
</ul>
</div>
Here is the jquery:
$(function () {
$('#menuebutton > ul').toggleClass('no-js js');
$('#menuebutton .js ul').hide();
$('#menuebutton .js').click(function(e) {
$('#menuebutton .js ul').slideToggle(200);
$('.clicker').toggleClass('active');
e.stopPropagation();
});
$(document).click(function() {
if ($('#menuebutton .js ul').is(':visible')) {
$('#menuebutton .js ul', this).slideUp();
$('.clicker').removeClass('active');
}
});
});
I tried it with chrome, firefox, and my android browser