admin管理员组文章数量:1322684
Is there a way to get the last names after # in the url in jquery/ javascript
I want to find the names #prices and make an if statment
if( the_last_name == 'prices' )
// do something
I need js/jquery to find a way to get urls last name ( and check it on the if statment /the_last_name)
Is there a way to get the last names after # in the url in jquery/ javascript
I want to find the names #prices and make an if statment
if( the_last_name == 'prices' )
// do something
I need js/jquery to find a way to get urls last name ( and check it on the if statment /the_last_name)
Share Improve this question asked Aug 30, 2009 at 13:21 williamwilliam 6063 gold badges14 silver badges29 bronze badges2 Answers
Reset to default 8Use this:
document.location.hash
eg:
if (document.location.hash == "#prices") {
Better, use this:
if (document.location.hash.substr(1) == "prices") {
so you don't have the '#' in your string.
本文标签: find last names in url after jquery javascriptStack Overflow
版权声明:本文标题:find last names in url after # - jquery javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742112232a2421306.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论