I created a jquery toggle, but when I click the link to open a div it will jump to the top of the page. how can I fix this?
I know I could replace the link with something else but I need to make it clear to the users that it’s a link and that they can click on it.
Add
return false;to the end of the code that runs when you click the link.Alternatively, you can grab the
eventobject, and call.preventDefault().Both of these methods disable the default behavior of the link.
The first one will also prevent the event from bubbling, so use it only if you have no need to utilize the event bubbling.