Main Problem : Get rid of # when user clicks on anchor tag. I found a solution for this, which is adding return false; in onClick handler
Secondary Problem : My current code looks like this
<a href="#" onclick="javaScript:toggleDisplay();" title="Some Title">
@ViewBag.TotalRecords
</a>
And according to solution I got, I want it like this
<a href="#" onclick="javaScript:toggleDisplay();return false;" title="Some Title">
@ViewBag.TotalRecords
</a>
- How can I append
return false;to my javaScript function call? I can do it manually, but is there any easy way to do this. I am using jQuery? - Is there any other way to get rid of
#, without modifying the current markup?
EDIT
@ViewBag.TotalRecords: This is a MVC3 ASP.Net thing, but it is not related to the question, hence I didn't put it in the tags.
Thanks
onclick="javaScript:toggleDisplay();"It is not an error, but thejavaScript:prefix is probably not doing what you think it is.toggleDisplay()function works properly, but I get#in my Query String. If I dotoggleDisplay(); return false;it is not there.