Text entry automatically copies the previous entry | XM Community
Skip to main content

I have a survey with 3 questions on a page - Q1 is a slideshow of 5 images (scrolling coded with js and html), Q2 and Q3 are simple text entry (numerical) questions (eg. how much would you be willing to pay for the product shown in the images). 

When I type in an answer to Q2, the text entry field of Q3 automatically starts populating with what I am typing in Q2. Q2 and Q3 do not have any js  - they are default qualtrics questions. 

If I remove the slideshow (Q1), things look normal. I am able to enter answers to Q2 and Q3 separately. Would anyone know how I can fix this? I would like to keep the slideshow and be able to type in answers to Q2 and Q3 as two separate questions…  

The js on Q1 is below 

var prevBtn = document.querySelector(".prev");
var nextBtn = document.querySelector(".next");
var slides = document.querySelectorAll(".mySlides");
    
    
    
    
var slideIndex = 1;
var viewedSlides = new Set(); 
showDivs(slideIndex);

function plusDivs(n) {
  showDivs(slideIndex += n);
}

function showDivs(n) {
  var i;
  var x = document.getElementsByClassName("mySlides");
  if (n > x.length) {slideIndex = 1}
  if (n < 1) {slideIndex = x.length} ;
  for (i = 0; i < x.length; i++) {
    x&i].style.display = "none";
  }
  xislideIndex-1].style.display = "block";
    
}
    
// Event listener for the previous and next buttons
prevBtn.addEventListener("click", function() {
  plusDivs(-1);
});

nextBtn.addEventListener("click", function() {
  plusDivs(1);
});
    

 

It seemed the issue was with the html and not js. Resolved now!


Leave a Reply