Wednesday, 15 September 2010

Programmatically add specific JavaScript to specific questions in Qualtrics? -


I have 50 pieces of JavaScript code that have been generated in Python with a text file, and currently I One should click on 50 questions, open the JS editor, then copy and paste the script related to my text file ...

I know that I have the generic JavaScript code "Survey and Experience", But this will not work because my javascript Each piece of code has a specific question in my survey; My JS has defined a method for Quatttrix. E.g., Qualtrics.SurveyEngine.addOnload (function () {/// my code}); And by putting the header in JS it does not seem to produce any effect.

More background information: I am implementing a focus investigation in my survey to ensure that the surveyors listen to audio clips in each question. Each audio element has an ID like "myAudio1", "myAudio2", ..., "myAudio50", and I have prepared my attention-checking javascript code for each question. I've imported my 50 questions on Qualtrics, but I do not want to manually "import" those 50 pieces of JS code!

The JavaScript in the Quartercraft header & lt; Script & gt; should be inside the tag.

You can add audio IDs in a hidden input field in your question text. After that there is a non-questionable javascript in the header, get that value from the ID

Example of input tag in the question text:

  This is my question text I & Lt; Input type = "hidden" id = "myAudioId" value = "myAudio2" & gt;  

In your JavaScript:

  var myAudioId = $$ ('myAudioId'). value;  

No comments:

Post a Comment