stefanplc
stefanplc

Reputation: 439

jQuery Error - can't figure out where I've made a mistake

I have the following code:

 -> alert("test");
    if (page == "work" && side_nav_state == 1) {
 ->     alert("test");
        $("#work_navigation_box").attr("class","worknav_rotate_out");
        $("#website_content").attr("class","content_slide_in");
    } else {
 ->     alert("test");
        $("#work_navigation_box").attr("class","worknav_rotate_out");
        $("#side_navigation_container").attr("class","horizontal_rotate_in");
        $("#min_side_navigation_container").attr("class","horizontal_rotate_over_out");
        $("#website_content").attr("class","content_slide_out");
        $("#side_navigation_container").css("display","block");
        setTimeout(function() { $("#navigation_box").css("display","block"); }, 200);
    }
 -> alert("test");

This code is inside an onclick function. If I add an alert "alert("test");" before the if statement it works however if I add it at the end of the if statement it doesn't work anymore. If I add it with the first part of the if statement or the else part, it also doesn't work. This leads me to believe that I have an error somewhere but I just can't figure out where it is. Obviously the arrows (->) and all the alert("test"); parts aren't inside the code, I added them each, one at a time to try and see where my code gets broken.

Anyone have any idea where I messed up the code? Thanks!

Upvotes: 0

Views: 28

Answers (1)

evilunix
evilunix

Reputation: 960

page or side_nav_state are probably not defined. Put them both in alerts at the top to check.

Upvotes: 1

Related Questions