![](/img/trans.png)
[英]How to stop the page from redirecting to another page without the user action (StopPropogation) and window.oneforeunload event?
[英]How to stop page from redirecting without event in Javascript or jQuery?
我有一个 ajax 插件,其中包含来自标签的大量 ajax 文件。 当用户点击它时,我没有看到它重定向到另一个页面。 尽管我们停止使用以下事件重定向页面:
$(button).click(function (e) {
e.preventDefault();
})
我想要一个阻止页面在没有事件的情况下重定向的功能。
function functionName() {
functiontostopredirect(); // I need a function like this.
}
您可以从该函数return false
:
function functionName() {
return functiontostopredirect(); // i need a function like this.
}
functiontostopredirect(){ return false;}
添加 return false ,onclick 按钮:
<button type="submit" onclick="return false;">Submit</button>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.