javascript and jquery in qualtrics - university of kent · javascript and jquery in qualtrics...

2
Javascript and JQuery in Qualtrics Making use of Javascript in Qualtrics Javascript in Qualtrics: Why, How, Examples :- Why: o "When you need to go beyond the features found in Qualtrics, JavaScript can help. JavaScript can be used to do everything from adding additional components to the survey page, to automatically progressing participants when they select an answer choice." How: o Bascially just click the 'cog' icon to the left of your question and select javascript from the menu -see http://www.qualtrics.com/university/researchsuite/developer-tools/custom- programming/javascript-in-qualtrics/ for more detailsDon't need to download and store, you can reference the Google developer links for now Examples o The Qualtrics website includes a lot of useful resources including these code snippets. o This example (download it and then import it into Qualtrics) shows a pseudo Lexical Decision task where a list of words is randomised and then shown, one at a time, with the participant responding by pressing one of 2 keys (j/k). It relies on targeting the 'id' of a named <span> tag which was created using the HTML editor option for the question text. Making use of JQuery in Qualtrics Firstly you can embed the <script> references within either the Footer part of the "Look and Feel" via source view o Don't need to download and store, you can reference the Google developer links for now o Eg... <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery- ui.css" rel="stylesheet" /> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> In your Qualtrics JS area, within the usual Qualtrics.SurveyEngine.addOnload area, declare the following at the top: 12 var jq = jQuery.noConflict();

Upload: trannhi

Post on 11-Oct-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Javascript and JQuery in Qualtrics - University of Kent · Javascript and JQuery in Qualtrics Making use of Javascript in Qualtrics Javascript in Qualtrics: Why, How, Examples :-

Javascript and JQuery in Qualtrics

Making use of Javascript in Qualtrics

Javascript in Qualtrics: Why, How, Examples :- Why:

o "When you need to go beyond the features found in Qualtrics, JavaScript can help. JavaScript can be used to do everything from adding additional components to the survey page, to automatically progressing participants when they select an answer choice."

How: o Bascially just click the 'cog' icon to the left of your question

and select javascript from the menu -see http://www.qualtrics.com/university/researchsuite/developer-tools/custom-programming/javascript-in-qualtrics/ for more detailsDon't need to download and store, you can reference the Google developer links for now

Examples o The Qualtrics website includes a lot of useful resources including these code

snippets. o This example (download it and then import it into Qualtrics) shows a pseudo

Lexical Decision task where a list of words is randomised and then shown, one at a time, with the participant responding by pressing one of 2 keys (j/k). It relies on targeting the 'id' of a named <span> tag which was created using the HTML editor option for the question text.

Making use of JQuery in Qualtrics

Firstly you can embed the <script> references within either the Footer part of the "Look and Feel" via source view

o Don't need to download and store, you can reference the Google developer links for now

o Eg...

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

<link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" rel="stylesheet" />

<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>

In your Qualtrics JS area, within the usual Qualtrics.SurveyEngine.addOnload area, declare the following at the top:

12 var jq = jQuery.noConflict();

Page 2: Javascript and JQuery in Qualtrics - University of Kent · Javascript and JQuery in Qualtrics Making use of Javascript in Qualtrics Javascript in Qualtrics: Why, How, Examples :-

You can now make use of jq as your jquery object (instead of $) and also the UI toolset if required.