Query String Link With Anchor Tag Not Working on Same Page

I have created a store/franchise locator page here. Once users click Contact Franchise on the locator, the franchise name is passed to the form underneath.

The query string looks like this webpage/?selected-franchise=Franchise%20Name

When I add the anchor to the form (webpage/?selected-franchise=Franchise%20Name#form), it works when you are coming from another page/open in a new window but when clicked on while on the same page, the page anchors down but does not refresh and pass on the Franchise name to the first form field.

Any advice on how to best approach this?

Topic query-string jquery hooks Wordpress

Category Web


I literally just ran into the same problem.

I found the answer on another post: https://stackoverflow.com/questions/12682952/proper-url-forming-with-a-query-string-and-an-anchor-hashtag/48728926#48728926

Use <form> instead of <a>

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.