How to hide/show and check/uncheck radio button | XM Community
Skip to main content
Question

How to hide/show and check/uncheck radio button

  • March 2, 2021
  • 2 replies
  • 384 views

I am trying to hide/show and check/uncheck radio buttons using custom code but it was not working as expected. Can someone help me to find out the solution.

Here is the logic-
   

var input = jQuery(("QR~QID161#1~1~1").replace(/~/g, "\\\\~"));
input.prop("disabled",true);
input.closest("td").find("*").hide();

Issue_screenshot_radiobutton.PNG

2 replies

PraDeepKotian_XM
QPN Level 5 ●●●●●
Forum|alt.badge.img+21
  • QPN Level 5 ●●●●●
  • March 2, 2021

Please try the below code and it should work. If you have more than 1 radio button to hide, then you can loop through.
var that = this.questionId;
jQuery("[id='QR~"+that+"~1"+"~1']").prop("disabled" , "true");
jQuery("[for='QR~"+that+"~1"+"~1']").css("display" , "none");


  • Author
  • March 2, 2021

Hi,
Thanks for the suggestion!!
But, I'm still having same issue and no change after placing piece of code on console and under question JavaScript section as well.
radiobutton_stillissue_exists.PNG