Hacker News new | ask | show | jobs
by parrispreston 5557 days ago
The standard is to use # in anchor tags that don't link anywhere that get hijacked with javascript and typically using jquery use e.preventDefault() which will stop the # from going into the address bar. You can also use return false. But e.preventDefault() is best practice. You need the # in the href because without it older browsers will not act like its a link which will prevent :hover from working. The # signs you are seeing all over the web are probably people who are not implementing preventDefault or return false. You could also be seeing them for sites that attempt to use something like jquery address for ajax navigation. If you are attempting to copy and share one of these links and it is not working then the developer didn't set up the ajax state management correctly for the particular app you are using. On a side note, you should probably leave these types of programming specific questions for stack overflow. I wouldn't consider this appropriate for hacker news in my opinion. Also you will probably get a larger response for this type of question on stack overflow. Heck, it has probably already been asked and answered multiple times on there.
1 comments

All good points. Thanks.