开发者

Jquery href with hash

开发者 https://www.devze.com 2023-01-03 10:54 出处:网络
i am using tis code for tab navigation. function hashIt(toHash) { toHash == \"\" ? window.location.hash = window.location.hash.replace( /#.*/, \"\")

i am using tis code for tab navigation.

function hashIt(toHash) {
    toHash == "" 
     ? window.location.hash = window.location.hash.replace( /#.*/, "") 
     : window.location.hash = toHash;
    return false;
}

and also i am using jquery popup on page onload. a hyperlink in the popup is not working, if i remove the h开发者_开发百科ashIt function its fine. but i want both. Please help me out.

Ramesh.


Your function should just be

function hashIt(toHash) {
    window.location.hash = toHash;
}

without all the extra logic. Then to clear the hash, just call hashIt("");


try to remove return false;, then check if it still works... (suspecting something)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号