Is there any way to prevent default event and then fire it again with jQuery?

I'm confused. If you just leave out the preventDefault, it will work as you intended.

I'm confused. If you just leave out the preventDefault, it will work as you intended. See jsFiddle here.

1 +1 For you too. No idea why any of us would deserve a downvote, the answer isn't wrong. – Lazarus May 19 at 15:47 @Eli - I RARELY down-vote people.

I believe in being positive. I did NOT down-vote you. Your answer is valid and an alternate way of accomplishing the task.

– Scott May 19 at 15:49 OK, didn't mean to accuse, so I apologize. I just don't see how most of these answers are getting downvoted. – Eli May 19 at 15:51 @Eli - In fact, if you look at my stats, I've only ever cast 4 down-votes.

– Scott May 19 at 15:52 1 (+1) for correct answer and for being fair – Dmitriy Naumov May 19 at 15:57.

PreventDefault marks the event as handled so that when your click function exits, the default action isn't taken. If you don't call preventDefault then the default click action won't get called until your click function exits. So remove it and it'll work as you are suggesting.

1 +1 for undeserved negative vote – Scott May 19 at 15:41.

The link will not go till after the work is done, so you can do: $('a'). Click(function(ev){ //do something here }).

After performing your desired action why don't you just redirect it to the page by adding this line: window. Location = 'welcome.php.

It can be done like this: link 1) The onclick needs to be before the href. 2) return true; makes sure that user will be taken to the linked page after your JS code executes. If you use return false; - linked itself will not work, it will just fire your JavaScript on click.

Negative voter - explain the reason – Dmitriy Naumov May 19 at 15:39 +1 for undeserved negative vote – Scott May 19 at 15:41 If the OP needed to rely on async processing, they should have mentioned it, as that would obviously need to preventDefault, and then call the window.location. Href in the complete callback. – Scott May 19 at 15:43 perhaps people have taken offence at the use of inline attributes for js rather than using unobtrusive event hookups – redsquare May 19 at 15:44 @Eli - I'm not going to assume what someone's reasoning is.

They can be direct with their question, or not. What we all posted IS true based on what his question was. – Scott May 19 at 15:46.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions