2690

If you don’t want jQuery to react to anchor links, you can use preventDefault(); if you don’t want to react to the anchor link in jQuery.

If you don’t want jQuery to react to anchor links, you can use preventDefault(); if you don’t want to react to the anchor link in jQuery.

2012.8.25

In jQuery, we need to add an anchor with # as a trigger to do the jQuery work in the href. tagging; in html terms, it responds as a link because it’s seen as an anchor, and and scroll to the top of the page.
I found a solution to this problem, so here’s a note

Confirmation Environment

code

First, let’s take a quick look at the code.


 

 

 


Specify e (abbreviation for event) for the function to be handled as a function and write e. preventDefault(); to prevent the processing as a link. It seems to be possible.