【发布时间】:2019-02-16 11:59:43
【问题描述】:
我试图在单击产生# 标记的锚点时提醒# 标记。
但我只在页面刷新后收到警报:
锚点:
$folderanchor = "<a class='folderanchor' href='#".$dir.'/'.$file."'>$file</a>";
echo $folderanchor;
阅读#:
$( document ).ready(function() {
if(window.location.hash) {
var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
alert (hash);
// hash found
} else {
// No hash found
}
});
单击锚点后应立即显示警报。我做错了什么?
【问题讨论】:
标签: javascript php jquery url