Trying to test for true using jquery

I have the following code:

console.log("Choice B is selected option - printing value below");
console.log($("#choiceBstatus").val());


if($("#choiceBstatus").val() == true ){

}

And console logs prints the following:

Choice B is selected option - printing value below 
true

But with this lineif($("#choiceBstatus").val() == true ){ it’s not entering inside this if block. Am I doing anything wrong here?

Should I be doing something like thisif($("#choiceBstatus").val()){ ?

It worked when I used if($("#choiceBstatus").val() === "true" ){

2 Likes