if else jquery click function

JavaScript
if(jQuery('#id').click) {
    //do-some-stuff
} else {
    //run function2
}
$(document).ready(function(){ 

	var n = $("#example div").length;

	if (n < 2) {
		$("body").css("background", "green");
	} 
	else {
		$("body").css("background", "orange");
	}

});
Source

Also in JavaScript: