SyntaxFix
Write A Post
Hire A Developer
Questions
If you just have a plain url string (and therefore don't have a hash attribute) you can also use a regular expression:
var url = "www.example.com/task1/1.3.html#a_1" var anchor = url.match(/#(.*)/)[1]