Why when clicking on a link throws on the top of the screen?

June 14th 19 at 18:05
3 answers
June 14th 19 at 18:07
Because href="#" leads to the beginning of the document. Make href="javascript:void(0)"
June 14th 19 at 18:09
Do you know what makes this code without js?
<a href="#" class="remove">Remove</a>

Due to the fact that the link is grate so throws up. You have in address bar the hash appears. That would not throw up, there are 3 options:
  1. To remove the attribute href="#" from the links
  2. Use a regular button that best. That's why they were invented
  3. Using js to remove the default action.
    $('a.remove').click(function(event){
    event.preventDefault();
    $('form').addClass('remove');
    });

June 14th 19 at 18:11
$('a.remove').click(function(e){
e.preventDefault();
$('form').addClass('remove');
});

Find more questions by tags HTMLCSSjQuery