Greenhoe
Greenhoe

Reputation: 1051

Use a blank link but not jump to top of page

I'm using a blank link to toggle a div through Jquery and in the link I have a blank link which allows you to click on the text to toggle the div but when you click toggle text the page jumps to the top. Is there a way to prevent this?

<a href="#" id="searchAnchor">Search Options</a>

Upvotes: 0

Views: 124

Answers (1)

Quentin
Quentin

Reputation: 943211

Use an <input type="button"> if you don't want the functionality of a link. Style it to look however you like.

(Alternatively, call preventDefault() on the event object, but that still leaves you with a link that isn't a link).

Upvotes: 2

Related Questions