-2

In my website I'm using an anchor tag that link to another page:

<li><a class="dropdown-item" href="/<%= term._id %>"><%= term.term %></a></li>

I need to add one more href link which is:

 href="#list-item-1"

Is it possible to add more than one href links in the same anchor tag.

The idea is that is that the anchor tag will redirect to another page and scroll down to a specific part of the page

ryan
  • 69
  • 1
  • 9

1 Answers1

1

You can simply append the hash at the end of the regular link:

<a class="dropdown-item" href="/<%= term._id %>#list-item-1"><%= term.term %></a>

Make sure there's no / or space between the term._id and the hash value.

That link when activated will load the URL provided, then jump to whereever the element with id="list-item-1" is located.

connexo
  • 53,704
  • 14
  • 91
  • 128