I am trying to create a floating div that appears when a button is clicked. It is not difficult, but when I click the button, the page automatically reloads. I do not know why.
I tried using Bootstrap Popover, but it does not work properly due to the same problem. When the popover starts, the page reloads, and the popover obviously disappears.
I use RoR, just saying in the case that it would be helpful to find out the problem.
I have something like this at the bottom of the document:
<a href="#" class="btn btn-small btn-warning" id="example">Show</a> <script type="text/javascript"> $(document).ready(function() { console.log("Page is loaded."); </script>
The first console.log
function inside the finished function is displayed when the page loads. When I run the "Show" button, this console.log
is displayed again in the browser console. And that makes no sense.
Thanks!
source share