How to set the value of an input field in JavaScript? | XM Community
Skip to main content
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!
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