How to enable the on load disabled textbox when the radio button is selected | XM Community
Skip to main content

How to enable the on load disabled textbox when the radio button is selected

  • November 8, 2022
  • 2 replies
  • 53 views

Forum|alt.badge.img+2

Hi Community,
I'm trying to enable the on load disabled textbox when the radio button is selected. When the yes (radio button) is being selected the disabled textbox should be enable

2 replies

Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+46
  • November 8, 2022

ricsdpl
You can use the below code linking it to your previous query.
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/

function notchange(){

if(jQuery('li').find('label').eq(0).hasClass('q-checked')){
     jQuery('.TextEntryBox.InputText.QR-QID24-1-TEXT.QWatchTimer').prop("disabled",true);
jQuery('.TextEntryBox.InputText.QR-QID24-1-TEXT.QWatchTimer').attr('placeholder', "");
    }
    else
    {
 jQuery('.TextEntryBox.InputText.QR-QID24-1-TEXT.QWatchTimer').prop("disabled",false);
jQuery('.TextEntryBox.InputText.QR-QID24-1-TEXT.QWatchTimer').attr('placeholder', "test");
     
    }
}
notchange()
});

Qualtrics.SurveyEngine.addOnReady(function()
{
jQuery('.TextEntryBox.InputText.QR-QID24-1-TEXT.QWatchTimer').attr('placeholder', "test");
 jQuery("[type='checkbox']").change(function()
  {


    if(jQuery('li').find('label').eq(0).hasClass('q-checked'))
    {
     jQuery('.TextEntryBox.InputText.QR-QID24-1-TEXT.QWatchTimer').prop("disabled",true);
jQuery('.TextEntryBox.InputText.QR-QID24-1-TEXT.QWatchTimer').attr('placeholder', "");
    }
    else
    {
 jQuery('.TextEntryBox.InputText.QR-QID24-1-TEXT.QWatchTimer').prop("disabled",false);
jQuery('.TextEntryBox.InputText.QR-QID24-1-TEXT.QWatchTimer').attr('placeholder', "test");
     
    }


  });
});


Change the QID appropriately. Hope it helps!


Forum|alt.badge.img+2
  • Author
  • November 14, 2022

Thank you Deepak!