Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含多个 div 类的 HTML 页面。在第二个 div 类中,我有一个注册表单。当我单击提交按钮并检查验证并弹出窗口时,单击弹出窗口后它会重定向到主 div,并且我希望注册 div 类在单击弹出按钮后保持不变。我怎样才能做到这一点?
如果您使用 href 来获取点击并调用 js 方法。您必须防止默认行为。即使您不使用href,它也可以解决您的问题。
function(e){ e.preventDefault(); // your code. return false; }
听起来您的链接的 href 值是 #
你可以添加
return false;
作为绑定到点击事件的函数的最后一行