Link for ajax calls that do nothing : javascript:doNothing(); return false;
Solution: Use javascript:void(0); Here are the full explanations.
Some link are processed via ajax and binded with the ID or class and don't have use of a HREF value because they don't go anywhere : they are binded via javascript. In this case it might be better to not put anything to avoid confusion of a link that don't exists.
Ideally if a non-ajax URL exists that can be use as a fallback, by all mean use it. But if there is none and you don't want to put anything in there do as follow :
As simple as this. Note that the 0 is important in the parameter.
<a id="bind-on-me" href="javascript:void(0);">click me</a>
Before I was using a doNothing() function.
<a id="bind-on-me" href="javascript:doNothing();">click me</a>
And in Javascript do the following :
function doNothing()
{ return;
}
I've been using this trick since 8 years.. and this year while writing this article, I went to look a bit around and Joomla also uses javascript:void(0) as well as Google Calendar (and probably other Google apps).
Recent Comments