How to fill in text inputs via javascript | XM Community
Skip to main content

I am programming a task where I need to store three outputs once the decision is made:

  1. The decision itself (A or B)
  2. The response time 
  3. The position of an element on the page. 

I added the following function to my decision buttons

function decision(dec) {
    let lInputs = document.getElementsByTagName("input");
    let time1 = new Date();
    lInputs 0].value = dec;
    lInputs1].value = time1 - time0;
    lInputs/2].value = document.getElementsByClassName("reverse").length;
    //Qualtrics.SurveyEngine.Page.next()
    document.getElementById("NextButton").click();
}
 

I checked and the inputs get correctly written if I use this code, but once I see the results on the survey, the answers are not recorded. 

 

My questions are:

  • Is there another way to do this?
  • Is there a better way to get the id of the questions to fill them in? (because I’m using a loop, the id’s are quite complicated)

Thank you in advance!

Be the first to reply!

Leave a Reply