我有以下内容,我认为它会起作用,但我似乎可以得到一个结果。
if (window.location.hash === '[data-toggle-box="' + window.location.hash + '"]') {
$("[data-toggle-box='" + window.location.hash + "']").addClass('active');
console.log('works');
}
在验证data-attr中的值时,我是否遗漏了一些小问题?