Reputation: 18525
I have a link as follows
<a href='#'>click to update the page</a>
What the link does it that it triggers a JavaScript code to update the contents of a div without posting back to the server.
The problem is that when I click the link, it always go to the top to the page due to href='#'
. Is it possible to avoid this movement?
Upvotes: 0
Views: 1637
Reputation: 15603
You can avoid to post the link by following code:
<a href='javascript:void(0);'>click to update the page</a>
use it the page will not be refresh by this.
Upvotes: 0
Reputation: 15106
Quick and dirty.
<a href='javascript:void(0)'>
You can also use CSS to simulate a hyperlink hand without using <a>
.
cursor: pointer;
Upvotes: 5