This is my URL:
www.example.com/contact#test
Now I need to test
. According to the research, I've found a site related to my problem, and I realized that I should use of hash
for get test
from my url. something like this:
var url = www.example.com/contact#test;
var anchor = url.hash;
alert(anchor);
but when I use of alert
for anchor
, it shows me undefined. anyway how can I get test
from my url ?
Easiest way to do is using split, if your URL has test only after the #. And also nothing other that test after the #.
The most efficient way is using pure JavaScript