Custom button not working as intended | XM Community
Skip to main content
I have created a custom button using following code:

<button id="service5">Add another service</button>

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.



!
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('');

}

});



});

Leave a Reply