gpt4 book ai didi

javascript - 在 # 之后查找 url 中的姓氏 - jquery/javascript

转载 作者:行者123 更新时间:2023-12-01 02:04:48 25 4
gpt4 key购买 nike

有没有办法在jquery/javascript中获取url中#后面的姓氏

我想找到名字#prices并做一个 if 语句

if( the_last_name == 'prices' ) 
// do something

我需要 js/jquery 找到一种获取 url 姓氏的方法(并在 if 语句/the_last_name 上检查它)

最佳答案

使用这个:

document.location.hash

例如:

if (document.location.hash == "#prices") {

关于javascript - 在 # 之后查找 url 中的姓氏 - jquery/javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1353853/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com