1

When we click <a href="#" onclick="function();">Post data to server</a>, the # is displayed at the end of the URL.

Is there a way to not have it displayed?

I have tried removing the href="file.ext" part, which works, though it produces unwanted results. It removed the color and underline styles of the hyperlink, making it appear to be just regular text.

Arrow
  • 2,784
  • 8
  • 38
  • 61

3 Answers3

4

try the javascript:void(0) it wil not display

 <a href="javascript:void(0)" onclick="function();">Post data to server</a>
NullPoiиteя
  • 56,591
  • 22
  • 125
  • 143
2

You could change the href to javascript: void(0);

Asad Saeeduddin
  • 46,193
  • 6
  • 90
  • 139
1

u can return false in the function

Arun Killu
  • 13,581
  • 5
  • 34
  • 61