有谁可以弄明白为什么这会给我在ie7中的空白警告框?
$("#bottles a").livequery("click", function(event) {
thetitle=$(this).attr("title");
alert(thetitle);
return false;
});
对于每个加载的新A标签,ie7警告空白消息(FF正确显示相应的标题)但是,当标题= $(this).html()时,ie7会提醒正确的信息。我在这里错过了什么吗?
答案 0 :(得分:0)
jQuery选择器和访问器对此过于苛刻。你试过这个吗?
$("#bottles a").livequery("click", function(event) {
// Always define a local variable, unless you explicitly
// want your variable to be globally scoped.
var thetitle = this.title;
alert(thetitle);
return false;
});
另外,你知道jQuery 1.3.x has LiveQuery built in吗?不再需要额外的插件了。