本文介绍了与evt.preventDefault()相反的是什么;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦我解雇了 evt.preventDefault(),我该如何重新恢复默认操作?

Once I've fired an evt.preventDefault(), how can I resume default actions again?

推荐答案

根据@Prescott的评论,相反:

As per commented by @Prescott, the opposite of:

evt.preventDefault();

可能是:

基本等同于'做默认',因为我们不再阻止它。

Essentially equating to 'do default', since we're no longer preventing it.

否则我倾向于向您指出另一条评论和答案提供的答案:

Otherwise I'm inclined to point you to the answers provided by another comments and answers:

请注意,第二个已被一个示例解决方案接受,由redsquare给出(此处发布了直接解决方案)如果没有关闭,则重复):

Note that the second one has been accepted with an example solution, given by redsquare (posted here for a direct solution in case this isn't closed as duplicate):

$('form').submit( function(ev) {
     ev.preventDefault();
     //later you decide you want to submit
     $(this).unbind('submit').submit()
});

这篇关于与evt.preventDefault()相反的是什么;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 17:41