Is there a way to batch edit the Javascript section of many questions at once? | XM Community
Skip to main content
I have found a way to batch edit custom HTML code using the `Search and Replace` function in Qualtrics as it searches and replaces the raw HTML text within each question.



However, there is no way to `Search and Replace` the Javascript section of questions. I have some custom coded functions that have been defined in the header section of the survey. I would like to add the same function call code in the Javascript section of over 30 questions. Is there a way to batch edit the Javascript section of multiple questions that are selected?



Thanks! This would save me a lot of time and clicking if made possible.
Hi, @sandys,



The JavaScript code is included in the QSF export, which you could edit offline in your scripting language of choice and re-upload. It might need some cleaning since it won't be preserved nicely:



!



Alternatively, you could define the code in the Header section with specifications to run on your chosen questions/pages.
Yes if you are not working with a published survey where you have begun collecting data you could edit the QSF file and upload to a new survey, but it will not allow updating the existing survey. Plus editing the escaped javascript within the JSON QSF file would not be the easiest. If you are using common javascript across surveys your bet is probably to do as @KoalaTricks mentioned about using a javascript include in your Header section of the Look & Feel/General settings (although you would need to write your code a bit differently and have a place to host your javascript source).

Leave a Reply