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

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

  • 8 November 2022
  • 2 replies
  • 40 views

Badge +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

Userlevel 7
Badge +36

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!

Badge +2

Thank you Deepak!

Leave a Reply