-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added JS file to add social media hyperlinks to a survey
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// This code allows you to add a hyperlink to an image in a Qualtrics survey. | ||
// My primary use case has been to create sharing buttons for social media platforms at the end of the survey. | ||
|
||
// ##### IMP #### | ||
// You'll have to use a URL shortner, if Qualtrics detects a social media site, it won't allow the image to load. | ||
// I've gotten it to work for ONLY Graphic Questions. Though they can be on the same page. If you find a way for other question types, please let me know. | ||
// I've also not been able to get the mouse pointed to change. Qualtrics' system settings keep overriding any CSS I add. | ||
|
||
// BOTH attributes need to added | ||
// "href" refers to the URL where you want the participants to go | ||
// "target : _blank" opens the link a new window. If you don't add this, the link opens in the same window and Qualtrics doesn't allow social media sites to load. | ||
|
||
Qualtrics.SurveyEngine.addOnReady(function () { // Didn't work on Qualtrics.SurveyEngine.addOnload | ||
let QuestionId = "#" + this.questionId; // Get the Question ID | ||
jQuery(QuestionId).wrap( | ||
jQuery("<a>").attr({ | ||
href: "your-url-goes-here", | ||
target: "_blank", | ||
}) | ||
); | ||
}); |