javascript - How do I remove # sign from hash data? jquery? -
i need value of hash url...
var hash = window.location.hash; so how rid of # sign?
as easy that.
var hash = window.location.hash.substr(1) there these 2 return exact same:
var hash = window.location.hash.slice(1) var hash = window.location.hash.substring(1) string.slice() added spec little later, although that's propably unimportant.
using replace mentioned below option, too.
none of options throw error or warning if window.location.hash string empty, depends on preferences use.
Comments
Post a Comment