Burak Sümer Burak Sümer - 2 years ago 71
jQuery Question

JQuery click brings me to top of page

I'm not so familiar with jquery. I made a popover but when i clicked on the button that i set the popover it brings me on top of the page. I tried to prevent default event but it didn't worked for me. I don't know where i'm wrong at. Here is my code:

<script>
$(document).ready(function(e) {
$('[data-toggle="popover"]').popover();
e.preventDefault();
});
</script>


Its just a few lines so wanted to write it in html file. What can i do to make it stay when i clicked on that button?

Here is my whole popover code:

<a href="#" data-toggle="popover" data-trigger="focus" title="Telefon" data-content="Call us: (123) 123 1234" class="btn btn-default" role="button">example</a>

Answer Source

@Burak Sümer, Remove # from href and change it to:

href="javascript:void(0)"

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download