![](/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.