![]() |
Possible to stop page jumping when # link is used?
Hello,
When I use an <a href> link internally with #, the page jumps to the top. Is there any way to stop this? Thanks |
Yep, don't include the href part in the <a>. So your link will look like this, for the time being:
Code:
<a>Link text</a> |
What I did was give the <a href> an id. Then the id went into the #:
<a href="#something" id="something">link is here</a> |
Quote:
|
Where you see code that reads
<a href="#">something</a> the # is supposed to be replaced with whatever page you intend to have the link take people to if it isn't overriden by JavaScript - you should never actually use it in a live web page. If it isn't intended to be a link to anywhere for those without JavaScript then don't code an <a> at all in the HTML.The one time when you might actually set the href to # is if the link is added from JavaScript and the script overrides the default action and you want the href there so that the browser adds it to the link collection and not the anchor collection. For example: Code:
var a = document.createElement('a'); |
Please remove that # sign.
|
Code:
<a href="javascript:void(0)" onclick="Index"> |
Quote:
|
| All times are GMT +1. The time now is 09:03 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.