How to set the value of an input field in JavaScript? | XM Community
Skip to main content
Question

How to set the value of an input field in JavaScript?

  • February 5, 2020
  • 1 reply
  • 281 views

Hi, I'm trying to replicate an old survey of my Professor from a different software into Qualtrics. The one thing I'm struggling with is to add a button that people can click, and if they do, a (predetermined) value should show in a text box next to it... I have found some (javascript) code online that should be able to do exactly this (see link), however, it doesn't work in Qualtrics Javascript... Somehow, in Qualtrics, you can use <>? https://www.geeksforgeeks.org/set-the-value-of-an-input-field-in-javascript/ Does anyone know how to solve this? Thanks!

1 reply

Akdashboard
Level 4 ●●●●
Forum|alt.badge.img+6
  • Level 4 ●●●●
  • 488 replies
  • February 5, 2020
You'll need to figure out the JavaScript code of triggering when the button is clicked, but this is how you set embedded data with JavaScript. Qualtrics.SurveyEngine.addEmbeddedData ( 'embedded data name' , 'value' )

Leave a Reply