M
M
Michael2015-10-07 20:37:01
JavaScript
Michael, 2015-10-07 20:37:01

How to rewrite text in URL?

Good evening!

When creating an "object" in a step-by-step form, when going to the next step, I add to the url #step-2 , the
link turns out like this: site.local/object/create#step-2
there was a problem, at the next step it is not clear how to replace 2 with 3?
given that there can be many steps in the form (up to 7) and some can be skipped, it turns out that simply replacing 2 with 3 will not work, I tried regular expressions, but so far I can’t figure out what’s what.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Inchin ☢, 2015-10-07
@xmentor

Change the hash, not the whole url:

location.hash = "#2";
location.hash = "#3";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question