我正在尝试创建一个 jQuery 搜索,它将找到刚刚更改数据属性的元素。搜索不起作用。这是 Javascript(从 CoffeeScript 编译):
new_temp_value = "" + (Math.round((new Date()).getTime() / 1000));
console.log("new_temp_value is " + new_temp_value);
$activity_div.data('temp', new_temp_value);
console.log('value of data-temp in $activity_div is now');
console.log($activity_div.data('temp'));
console.log($activity_div.hasClass('activity_div'));
console.log($(".activity_div[data-temp='" + new_temp_value + "']"));
输出
new_temp_value is 1336020404
value of data-temp in $activity_div is now
1336020404
true
[]
出了什么问题?