1
说我有两个绑定事件 - 点击和hashchange按照以下(超简化的例子):传递参数
$('a').bind('click', function(e) {
location.hash = $(this).attr('id');
}
$(window).bind('hashchange', function(e) {
console.log(e.target);
}
我将如何通过元素的提高点击事件ID绑定到hashchange事件? 我见过像下面的例子,但不能得到它的工作:
$('a').bind('click', ['some-data'], function(e) {
location.hash = $(this).attr('id');
}
$(window).bind('hashchange', function(e) {
console.log(e.data[0]);
}
任何意见将是巨大的......