-1

In my HTML code, I have a list element ID such as:

<li id="pageHome">

And, when I want to reference to it, I have:

<h1><a href="#!/pageHome" id="logo">Interior</a></h1>

This works fine, however, when I load my website, I noticed that when I want to go my home page, the link looks like this:

mywebsite.com/#!/pageHome

I don't think this looks professional. Is there anything that I can do such that anytime that I want to go to main page, it shows something like this instead?

mywebsite.com/pageHome

j08691
  • 204,283
  • 31
  • 260
  • 272
Rudy01
  • 1,027
  • 5
  • 18
  • 32

2 Answers2

2

The dash will always appear, but you can prevent the backslash and exclamation mark from appearing in the url, as writing href="#pageHome" is sufficient

fifou
  • 65
  • 6
Loïc Gammaitoni
  • 4,173
  • 16
  • 39
1

#pageHome should work perfectly fine.

Also check How do I scroll to an element using JavaScript? for JS solutions!

Community
  • 1
  • 1
Rstew
  • 585
  • 2
  • 9
  • 21