Dealing with multiple Javascript IF statements.

Posted by Joey on Stack Overflow See other posts from Stack Overflow or by Joey
Published on 2009-09-10T04:34:37Z Indexed on 2010/03/27 1:33 UTC
Read the original article Hit count: 288

Is it possible to put multiple IF statements in Javascript? If so, I'm having a fair amount of trouble with the statement below. I was wondering if you can put another IF statement in between if (data == 'valid') AND else? I want to add another if data =='concept') between the two.

if (data == 'valid') {
            $("#file").slideUp(function () {
                $("#file").before('<div class="approvedMessage">WIN WIN WIN!</div>');
                setTimeout(ApprovedProof, 5000);
            });

            function ApprovedProof() {
                $("#file").slideDown();
                $('.approvedMessage').fadeOut();
            }

        }
        else {

            $("#file").slideUp(function () {
                $("#file").before('<div class="deniedMessage">NO NO NO!</div>');
                setTimeout(DeniedProof, 5000);
            });

            function DeniedProof() {
                $("#file").slideDown();
                $('.deniedMessage').fadeOut();
            }
        }

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about functions