go to post Alex Kogan · Apr 5, 2022 The solution was adding .trim() to the end, so: FruitSelected=$('[name='Nameoftheradiobuttonhere]:checked').parent().text().trim(); Then everything works as it should. It appears that there was some char, which would not allow the true/false to work properly, while displaying correctly in alerts and trim() takes them all out. Thank you Tim!