How to stop the preventDefault()
function and what is opposite function of the preventDefault()
function. How to enable the links after call of ajax stop function?
Asked
Active
Viewed 423 times
0

putvande
- 15,068
- 3
- 34
- 50

waqar mirza
- 555
- 2
- 15
-
5There's no opposite to `preventDefault()`. Simply have a condition when preventing the default. – George Jul 30 '13 at 09:38
-
check out this http://api.jquery.com/event.preventDefault/ – Arun Chandran Chackachattil Jul 30 '13 at 09:40
-
possible duplicate of [What is the opposite of evt.preventDefault();](http://stackoverflow.com/questions/5651933/what-is-the-opposite-of-evt-preventdefault) – Felix Kling Jul 30 '13 at 09:41
4 Answers
0
Simple don't use it!
If your link is :
<a href="www.google.com" id="myLink">link</a>
and your event is:
$('#myLink').click(function(){
console.log('no prevent')
//some code
return true:
});
after log you go to google...

grigno
- 3,128
- 4
- 35
- 47
0
You are using preventDefault()
as
function(e){ e.preventDefault()};
and its opposite
function(e){ return true; }
Hope it will help you :)

Community
- 1
- 1

Arun Chandran Chackachattil
- 3,356
- 7
- 31
- 45
0
There isn't an opposite to preventDefault()
. The opposite to that would be 'do default' which, of course, is done, by default. You need to run a condition that will decide whether the default is prevented, before preventing it.
//Your hypothetical 'do default'
e.preventDefault()
if(condition){
e.doDefault(); //METHOD DOES NOT EXIST!
}
//How you should do it
if(!condition){
e.preventDefault();
}

George
- 36,413
- 9
- 66
- 103
0
return false; e.preventDefault();
both work same it prevents the process and stop the execution
and about your question there is one option return true;
to continue the execution of function.
I hope it will help to solve the problem.

BenMorel
- 34,448
- 50
- 182
- 322

Sonu Sindhu
- 1,752
- 15
- 25