I have a URL that is like:
www.example.com/task1/1.3.html#a_1
How can I get the a_1 anchor value using jQuery and store it as a variable?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the
.indexOf()and.substring(), like this:You can give it a try here, if it may not have a
#in it, do anif(url.indexOf("#") != -1)check like this:If this is the current page URL, you can just use
window.location.hashto get it, and replace the#if you wish.