I was setting up a basic question/answer page, I thought to use jQuery to let the user toggle visibility of the answer. My thought is that you can't see the answer straight away so you have a decent change of thinking about it and learning it easier.

It was going well, until I had more than a single screen and it needed to scroll down, the link I had created for the toggle was scrolling to the top of the page. A quick google search found the issue. Basically I was using a hash in the url like this:

<a href="#">Show Answer</a>

I found that I needed to change it to this:

<a href="javascript:void(0);">Show Answer</a>

Here's the page that I found explaining it more: http://jaredheinrichs.com/clicking-on-hyperlink-causes-page-to-jump-to-t... .

I figured that lists solutions like this will give me something to look back on and an extra place for others to find the answer as well.

Tags: Solved | jQuery