1$('#myElementID').click(function() {
2 var isSomethingTrue = true;
3
4 if(isSomethingTrue){
5 alert("something is true");
6 }else{
7 alert("something is false");
8 }
9});
1$(document).ready(function(){
2
3 var n = $("#example div").length;
4
5 if (n < 2) {
6 $("body").css("background", "green");
7 }
8 else {
9 $("body").css("background", "orange");
10 }
11
12});