Answers for "if else jquery click function"

1

jquery if else on click

$('#myElementID').click(function() {
	var isSomethingTrue = true;
    
    if(isSomethingTrue){
    	alert("something is true");
    }else{
    	alert("something is false");
    }
});
Posted by: Guest on October-23-2019
0

if else jquery click function

if(jQuery('#id').click) {
    //do-some-stuff
} else {
    //run function2
}
Posted by: Guest on December-19-2020
0

jquery if else click function

$(document).ready(function(){ 

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

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

});
Posted by: Guest on July-03-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language