-2
$(document).ready(function() {
    if ( // condition ) {
        //do stuff
    }
    else ( // how do you jump to another separate function from this else statement? ) {};
});

for example: I have another function (jump). and I want to run the function after else statement and I dont want it inside the previous code.

function jump(e) {
    // blah blah
};
4

2 回答 2

1

只需从 else 条件调用该函数。

于 2013-05-02T03:38:15.307 回答
1

只需调用部分jump中的方法else

$(document).ready(function() {
    if ( condition ) {
        //do stuff
    } else {
        jump();
    }
});
于 2013-05-02T03:38:25.073 回答