Trying to test for true using jquery

I have the following code:

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

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


And console logs prints the following:

Choice B is selected option - printing value below 

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" ){


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.