Javascript 链接不可点击,因为JS返回false
我正在使用导航栏中的“FOO”、“BOO”项操作下拉框,并在外部发生单击事件时使用以下代码关闭下拉框,该代码工作正常Javascript 链接不可点击,因为JS返回false,javascript,jquery,Javascript,Jquery,我正在使用导航栏中的“FOO”、“BOO”项操作下拉框,并在外部发生单击事件时使用以下代码关闭下拉框,该代码工作正常 $(document).on('click', '.dd-box', function() { // Comment out the return statement below and the links will start working. return false }); 我遇到的问题是,这也会阻止访问下拉框中的链接 我之所以需要这段代码,是因为我不希望下拉框在
$(document).on('click', '.dd-box', function() {
// Comment out the return statement below and the links will start working.
return false
});
我遇到的问题是,这也会阻止访问下拉框中的链接
我之所以需要这段代码,是因为我不希望下拉框在单击事件发生时关闭
我试图避免使用诸如window.open之类的黑客来强制链接不被访问,有什么想法吗?你应该把
非常感谢您的帮助
$(document).ready(function() {
$("a").click(function(e) {
e.stopPropagation();
});
...