开发者

how to stop the else condition from executing?

I have a condition where the else condition executes even the the if condition is true. How manually stop the else condition from executing when the true condition executes? I tried return false. In this case, break does not work.

$(document).keydown(function(e) 
{
    if开发者_C百科 (e.which == 38)
    {
        code inside works
    } 
   else if (e.which == 40) 
    {
        if (current_list_item >= end_of_list) 
        {
            alert("Reached the end");
            return false;
        } 
        else 
        {
            alert("Add more items");
        }
    }
});


That's impossible. The "if" condition is true.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜