Problem with href attribute in named anchors
October 30th, 2013 by NikSometimes even the simplest things in life that we always took for granted seems to give us a kick on our backside. That is when we get to learn little lessons of life. The simplest piece of code that always worked like charm, fails to work, Today was just that day. I had an issue with a named anchor which I had defined to add a Jquery Smooth Scroll. The scroll to an anchor just failed to work … thankfully it was a very simple fix.
The code that I had (when the named anchor did not work)
<a href="" id=â€a_rate_thisâ€></a>
Got fixed when , I replaced the above with
<a href=â€javascript:void(0);†id=â€a_rate_thisâ€></a>
Or even just remove the href attribute as below <a id=â€a_rate_thisâ€></a> yeah! but in this case you will loose the default pointer cursor
of the anchor tag and it will change to cursor of type text.
You could solve this issue with a css fix,
i.e. by adding cursor:pointer to the anchor tag.
Tags: Named Anchors
Subscribe to ExpressingIT by Email | Follow Me on Twitter