Search code examples
wordpressurlanchor

How to get to the target # anchor on clicking url (wordpress)?


I need to get to the #anchor when clicking url.
I used following url, but it doesn't go to the target # anchor.
It only opens customer-service page.
I tried to add tabindex="0" , but still doesn't get to the #anchor (no error in console).
Would you please let me know how to get to the target # anchor?

Customer-service page:

<div  id="faq"></div>
<div  id="feedback"></div>
<div  id="contact-us" tabindex="0" ></div>

Url I tried:
https://www.myweb.com/en/customer-service#feedback/

https://www.myweb.com/en/customer-service/#feedback/

Thank you.

Solution

  • Make sure that your div area is visible (overflow). Try below structure.

    <div id="faq" style="overflow:auto;min-height:200px;"> Content 1</div>
    <div id="feedback" style="overflow:auto;min-height:200px;"> Content 2</div>
    <div id="contact-us" tabindex="0" style="overflow:auto;min-height:200px;"> Content 3</div>
    

    URL : https://www.myweb.com/en/customer-service/#feedback