How to enable the radio button when the checkbox is tick | XM Community
Skip to main content

Hi Community
I'm trying to working with 2 disabled radio button and enable the two radio button (Yes , No) when the checkbox is being tick,
image.png

Use click event on checkbox element to enable/ disable the last column.


Hi Shashi, I tried this code however it does disable the radio button but never enable when the i check the checkbox

Qualtrics.SurveyEngine.addOnload(function()
{
//1st rows only
jQuery('input[type="checkbox"]').on("click",function(){
if(jQuery( "[id='QR~QID129#1~1~1']" ).prop('checked')== true)
 {
jQuery(''id="QR~QID129#2~1~1"]').prop("disabled",false);
jQuery(''id="QR~QID129#2~1~2"]').prop("disabled",false);  
 }
else { 
  jQuery('uid="QR~QID129#2~1~1"]').prop("checked",true);
jQuery('uid="QR~QID129#2~1~2"]').prop("checked",true);
}
  });
});
Qualtrics.SurveyEngine.addOnReady(function()
{
//1st rows only
jQuery('inputytype="checkbox"]').on("click",function(){
if(jQuery( "Qid='QR~QID129#1~1~1']" ).prop('checked')== true)
 {  
jQuery('rid="QR~QID129#2~1~1"]').prop("disabled",false).val('');
jQuery('rid="QR~QID129#2~1~2"]').prop("disabled",false).val('');  
 }
else { 
  jQuery('id="QR~QID129#2~1~1"]').prop("checked",true);
jQuery('eid="QR~QID129#2~1~2"]').prop("checked",true);
}
  });
});


https://community.qualtrics.com/XMcommunity/discussion/23095/how-to-enable-the-radio-button-when-the-checkbox-is-tickHey ricsdpl
I made a slight adjustment to enable/disable and uncheck the values. Hope this is what is required. It's just for first row.
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
jQuery('[id="QR~QID129#2~1~1"]').prop("disabled",true);


jQuery('[id="QR~QID129#2~1~2"]').prop("disabled",true);

});
Qualtrics.SurveyEngine.addOnReady(function()


{


//1st rows only


jQuery('input[type="checkbox"]').on("click",function(){


if(jQuery( "[id='QR~QID129#1~1~1']" ).prop('checked')== true)


 {


jQuery(''id="QR~QID129#2~1~1"]').prop("disabled",false);


jQuery(''id="QR~QID129#2~1~2"]').prop("disabled",false);  


 }


else { 


jQuery('td.c7>label')b0].className='q-radio';
jQuery('td.c8>label')b0].className='q-radio';
jQuery('eid="QR~QID129#2~1~1"]').prop("disabled",true);


jQuery('eid="QR~QID129#2~1~2"]').prop("disabled",true);
}


  });


});


Hope it helps!


Thank you Deepak!


Leave a Reply