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

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -