$('#myElementID').click(function() { var isSomethingTrue = true; if(isSomethingTrue){ alert("something is true"); }else{ alert("something is false"); } });