jquery:fire href但要添加#散列吗?

jquery:fire href但要添加#散列吗?,jquery,hash,click,add,Jquery,Hash,Click,Add,我希望我所有的链接都能正常启动,但最后会被调用一个wpf包装散列 现在,当我点击一个链接时,该链接不再被触发 也许这会有帮助 /*Forum maintain scrollposition*/ $('#wpf-wrapper a').each(function() { $(this).click(function() { $(this).attr('href', $(this).attr('href') + "#wpf-wrapper"); }); }); 希望

我希望我所有的链接都能正常启动,但最后会被调用一个wpf包装散列

现在,当我点击一个链接时,该链接不再被触发

也许这会有帮助

/*Forum maintain scrollposition*/
$('#wpf-wrapper a').each(function() {
    $(this).click(function() {
        $(this).attr('href', $(this).attr('href') + "#wpf-wrapper");
    });
});
希望有帮助。

也许这会有帮助

/*Forum maintain scrollposition*/
$('#wpf-wrapper a').each(function() {
    $(this).click(function() {
        $(this).attr('href', $(this).attr('href') + "#wpf-wrapper");
    });
});

希望有帮助。

试试这个-它会在页面加载时重写链接,而不是单击:

$('#wpf-wrapper a').live('click',function() {       
    $(this).attr('href', $(this).attr('href') + "#wpf-wrapper");        
});

尝试此操作-它会在页面加载时而不是单击时重写链接:

$('#wpf-wrapper a').live('click',function() {       
    $(this).attr('href', $(this).attr('href') + "#wpf-wrapper");        
});

您不需要在单击时执行此操作

$(function() {
    $('#wpf-wrapper a').each(function() {
        $(this).attr('href', $(this).attr('href') + "#wpf-wrapper");
    });
});

您不需要在单击时执行此操作

$(function() {
    $('#wpf-wrapper a').each(function() {
        $(this).attr('href', $(this).attr('href') + "#wpf-wrapper");
    });
});

你也可以做一个简单的重定向

$('#wpf-wrapper a').each(function() {
    this.href = this.href + '#wpf-wrapper';
});

你也可以做一个简单的重定向

$('#wpf-wrapper a').each(function() {
    this.href = this.href + '#wpf-wrapper';
});

我已经试过了,没什么区别!一旦我添加哈希,链接就不会被触发!我已经试过了,没什么区别!一旦我添加哈希,链接就不会被触发!谢谢你,这就成功了!不知道为什么,但是live()处理程序使其工作。谢谢,这就成功了!不知道为什么,但是live()处理程序使其工作。