Skip to content

Instantly share code, notes, and snippets.

View marketinview's full-sized avatar

Market In View marketinview

View GitHub Profile
@marketinview
marketinview / leftAlignItemsInPGR.js
Last active October 23, 2022 16:35
Qualtrics: Left Align Items in a Pick Group Rank. #qualtrics #js #jq #pgr
Qualtrics.SurveyEngine.addOnload(function() {
//Left align items in a Pick Group Rank
jQuery("#"+this.questionId+" span.LabelWrapper").css("text-align", "left");
});
@marketinview
marketinview / underlinePhrasesInHighlightQuestion.js
Last active October 23, 2022 16:35
Qualtrics: Underline Phrases in Highlight Question. #qualtrics #js #jq #highlight #concept
Qualtrics.SurveyEngine.addOnload(function() {
//Underline phrases in Highlight question
jQuery("#"+this.questionId+" span.HLTextWord").css("text-decoration", "underline");
});
@marketinview
marketinview / changeWidthAlignOfMCButton.js
Last active October 23, 2022 16:36
Qualtrics: Change width and alignment of multiple choice button. #qualtrics #js #jq #mc #button #width #align
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" label.SingleAnswer:first").css({"width":"50%", "text-align":"center"});
});
@marketinview
marketinview / focusOnTextEntryField.js
Last active October 23, 2022 16:36
Qualtrics: Focus on Text Entry Field #qualtrics #js #jq #text #focus #cursor
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" .InputText:first").select().focus();
});
@marketinview
marketinview / hideSeparatorBeforeQuestion.js
Last active October 23, 2022 16:37
Qualtrics: Hide Separator Before Question. #qualtrics #js #jq #hide #separator
Qualtrics.SurveyEngine.addOnReady(function() {
jQuery("#"+this.questionId).prev('.Separator').hide();
});
@marketinview
marketinview / generalJSProcessFramework.js
Last active October 23, 2022 16:38
Qualtrics: General JavaScript Process Framework. This is a just a general framework for a javascript that runs a process and returns an embedded data variable. It uses a hidden descriptive text question. #qualtrics #js #jq
Qualtrics.SurveyEngine.addOnReady(function() {
jQuery("#"+this.questionId).hide();
jQuery('#Buttons').hide();
var var1 = parseInt("${q://QID1/ChoiceTextEntryValue}");
//algorithm goes here to assign answer to variable answer
Qualtrics.SurveyEngine.setEmbeddedData('answer',answer);
jQuery('#NextButton').click();
});
@marketinview
marketinview / addSymbolBeforeAfterText.js
Last active April 29, 2024 11:13
Qualtrics: Add Symbol or Text Before and/or after Open End Text entry. #qualtrics #js #jq #text
Qualtrics.SurveyEngine.addOnload(function() {
var input = jQuery("#"+this.questionId+" .InputText");
input.before("$ ");
input.after(" /mo");
input.select().focus(); //optional, focus on input field
});
@marketinview
marketinview / adjustCSInputTextWidths.js
Last active September 11, 2023 05:55
Qualtrics: Adjust Constant Sum Input Text Widths. Change "75px" as needed. #qualtrics #js #jq #csum #input #text #width
Qualtrics.SurveyEngine.addOnload(function() {
var inputWidth = "75px";
var q = jQuery("#"+this.questionId);
q.find('.SumInput').css("width", inputWidth);
q.find('.SumTotal').css("width", inputWidth);
q.find('.InputText').css("width", inputWidth);
});
@marketinview
marketinview / adjustMatrixTextInputWidths.js
Last active October 23, 2022 16:41
Qualtrics: Adjust Matrix Text Input Widths. Adjust "75px" as needed. #qualtrics #js #jq #matrix #input #text #width
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" input").css("width", "75px");
});
@marketinview
marketinview / Qualtrics_DetectJFE.js
Last active November 4, 2019 00:50
Qualtrics: Detect JFE (Jiffy). This snippet detects if Qualtrics is in standard of JFE mode. Some scripts are dependent on the which mode Qualtrics is running. This code can be included to detect the mode and act accordingly using if(jfe). #qualtrics #js #jfe
var jfe = false;
if(/^\/jfe/.test(window.location.pathname)) jfe = true;