gpt4 book ai didi

jquery - Wordpress: Hook 更新后按钮或表单以进行验证

转载 作者:行者123 更新时间:2023-12-01 08:21:18 25 4
gpt4 key购买 nike

我想在某些情况下取消帖子更新而不需要重新加载整个页面。

我已经尝试过:

// publish is the id of the Update button.
$('#publish').click(function(){
return false;
});

// post is the id of the corresponding form.
$('#post').submit(function(){
return false;
});

在这两个代码中,表单均未提交,但“更新”按钮保持禁用状态,并且显示了 ajax 加载器 gif。

我怎样才能做到这一点?提前致谢。

最佳答案

我认为因为 WordPress 已经在该元素上有一个事件处理程序,所以它返回什么并不重要,它只是触发两个偶数处理程序。试试这个:

$('#publish').click(function (event) {
event.stopPropagation();
});

关于jquery - Wordpress: Hook 更新后按钮或表单以进行验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7245714/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com