-1

Possible Duplicate:
What does “javascript:void(0)” mean?

In the below snippet what does javascript:void mean ? How can i make the user follow the link when he clicks the logout link provided href="javascript:void"?

<a href="javascript:void()" id="logout" onClick="#" ><strong>Logout</strong></a>
Community
  • 1
  • 1
saplingPro
  • 20,769
  • 53
  • 137
  • 195
  • 1
    Related: http://stackoverflow.com/questions/134845/href-for-javascript-links-or-javascriptvoid0 – fncomp Apr 20 '12 at 03:14

1 Answers1

2

void is a function that takes any input and returns nothing.

It is commonly used in links to make them not go anywhere. Kind of like the links that have href="#", but without affecting the browser history. There is almost always an onclick event attached that tells the browser what to actually do. In the code you gave, the onclick attribute is not valid JavaScript...

If you want the link to actually go somewhere, just use a regular href.

<a href="logout.php" id="logoug"><strong>Logout</strong></a>
Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592