Q:

If statement not working with cookie

I'm setting a cookie value to 1 when a user clicks on an upload button:
$('.uploadbtn2').click(function(){
    $(this).val("Please wait...");
    $.cookie("upload",1,{ expires: 1, path: '/' });
    // the page then refreshes a few seconds later
});

if ($.cookie("upload")===1) {
    $('.upload-photo').show();
}

If the value of the cookie is equal to 1, then the popup upload div shows. But it isn't showing.
If I do this:
alert($.cookie("upload")) beneath, it alerts "1".
And
$('.upload-photo').show() outside the if statement, the div shows. Why in't it working?

A:

Because you are comparing type and value both by ===, where your cookie gives you 1 as a string. 
so two options you can apply, 
either
parseInt($.cookie("upload"))===1

OR
$.cookie("upload") == 1

