How to reset and disable textbox when the checkbox is checked | XM Community
Skip to main content

Hi Community,
I'm trying to work with reset the value and disable textbox when the checkbox is checked. I tried to do it but what I only work is disable the textbox. How to add the reset the value of textbox

jQuery('input[type="checkbox"]').on("click",function(){
if(jQuery( "[id='checkboxid']" ).prop('checked')== true)
 {   
jQuery('yid="textboxid1"]').prop("disabled",true);
else {
  jQuery('rid="textboxid1"]').prop("disabled",false);
}
  });



ricsdpl
You can use the below code and replace the QID appropriately.
Qualtrics.SurveyEngine.addOnReady(function()
{

jQuery("[type='checkbox']").change(function()
  {


    if(jQuery('li').find('label')l0].className == 'q-checkbox q-focused q-checked')
    {
     jQuery('.TextEntryBox.InputText.QR-QID16-1-TEXT.QWatchTimer').prop("disabled",true);
    }
    else
    {
 jQuery('.TextEntryBox.InputText.QR-QID16-1-TEXT.QWatchTimer').prop("disabled",false);
     
    }


  });
});

Presuming your question looks like this:
image.png
Hope it helps!


Deepak how about the reset the value of the textbox
remove the test value in the textbox
image.png


ricsdpl
https://community.qualtrics.com/XMcommunity/discussion/comment/51834#Comment_51834You can use below code to remove the placeholder.
Qualtrics.SurveyEngine.addOnReady(function()
{
jQuery('.TextEntryBox.InputText.QR-QID16-1-TEXT.QWatchTimer').attr('placeholder', "test");
 jQuery(""type='checkbox']").change(function()
  {




    if(jQuery('li').find('label')e0].className == 'q-checkbox q-focused q-checked')
    {
     jQuery('.TextEntryBox.InputText.QR-QID16-1-TEXT.QWatchTimer').prop("disabled",true);
jQuery('.TextEntryBox.InputText.QR-QID16-1-TEXT.QWatchTimer').attr('placeholder', "");
    }
    else
    {
 jQuery('.TextEntryBox.InputText.QR-QID16-1-TEXT.QWatchTimer').prop("disabled",false);
jQuery('.TextEntryBox.InputText.QR-QID16-1-TEXT.QWatchTimer').attr('placeholder', "test");
     
    }




  });
});
Hope it helps!


Thank you Deepak!


Leave a Reply