Can I execute a link after a preventDefault()?

jquery

Solution

Just move the `preventDefault` inside the if/else statement:

$('#myLink').click(function (e) {

    ...

    if (someCondition) {
        e.preventDefault();

        ... code ...

    } else {
        ... execute the link
    }
});

Problem

Code : ``` $('#myLink').click(function (e) { e.preventDefault(); ... if (someCondition) { ... code ... } else { ... execute the link } }); ``` I'd like, if `someCondition` is false, execute the original href of the link (so, go that link, changing the page). Is it this possible?

Original source

Related problems