Custom button not working as intended

MadihaMadiha Community Member Qubie ✭

Custom button not working as intended

I have created a custom button using following code:
Add another service
Whenever user clicks the button a text-box show up. I did that using JavaScript
Problem is even if user click outside of the button, inside the area shown in the picture, for some reason button gets clicked and the text box appears. I do not understand what I am doing wrong. I am new in qualtrics and would really appreciate your help. I have also attached the .qsf file here.

Best Answer

  • AdamBostonAdamBoston Essex, UK Qubie ✭
    edited November 2018 Accepted Answer

    I'm not sure if it helps, but are you able to resize the button at least to reduce the chances of this happening?

    I have a text box field appear once a radio button is pressed (so slightly different circumstances)

    but the following worked by entering this into the JS for that question

    Qualtrics.SurveyEngine.addOnReady(function()
    {
    /Place your JavaScript here to run when the page is fully displayed/
    jQuery("#"+this.questionId+"-Advance").hide();
    var that=this.questionId;
    jQuery("#"+that+" .InputText").hide();
    var n= jQuery("#"+that+" .InputText").attr('id');
    var choicenumber=n.split("~")[2];
    jQuery("#"+ this.questionId+" input[type='radio']").on('change',function(){
    if(jQuery("[id='QR~"+that+"~"+choicenumber+"']").prop('checked')){
    jQuery("#"+that+" .InputText").show();
    }else{
    jQuery("#"+that+" .InputText").hide().val('');
    }
    });

    });

Sign In to Comment