How to use condition statement IF ELSE in Jquery JavaScript

Description

Apply IF ELSE condition statement in Jquery JavaScript (JS) inside the JS Rule function and syntax for if else condition in javascript.If else condition apply inarray or array.condition statement apply event If Statement.Implement if else condition statement in a jquery on event function

condition statement apply with example

var idValue = $('#useid').val();

if (useidValue == "choose" || useidValue == "boom" || useidValue == "foo" || useidValue == "bar") {

 statement

}

if ($('#iduse').val() == "bell") {

    //dialog show

}

 

If else condition apply inarray or array

var useraraayvalues = ["bell","bat","boll","cat"];

if ($.inArray($('#userid ').val(),useraraayvalues) != -1) {  // -1 set array return -1 start 0

    // start content

} else {

    // content

}

 

if (setcondition) {

    Content start

}

 

jQuery('#idlist').click(function () {

   // content

});