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

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

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!


Thank you Deepak!


Leave a Reply