Skip to content

Instantly share code, notes, and snippets.

View marketinview's full-sized avatar

Market In View marketinview

View GitHub Profile
@marketinview
marketinview / answerOneChoiceMC.js
Last active October 23, 2022 15:03
Qualtrics: Automatically answer a multiple choice question with only one choice and go to next page. #qualtrics #js #jq #mc #carryforward
Qualtrics.SurveyEngine.addOnReady(function() {
var qobj = this;
var displayedChoices = [];
jQuery.each(qobj.getChoices(), function(index, value) {
if(qobj.getChoiceDisplayed(value)) displayedChoices.push(value);
});
if(displayedChoices.length == 1) {
qobj.setChoiceValue(displayedChoices[0], true);
qobj.clickNextButton();
}
@marketinview
marketinview / SBSVerticalLabels.css
Last active October 23, 2022 15:04
Qualtrics: Side-by-Side Vertical Labels. #qualtrics #css #sbs #label #vertical #rotate
<style>
.Skin .SBS .Answers th.SBS1, .Skin .SBS .RepeatHeader td.SBS1 {
transform: rotate(-90deg);
white-space: nowrap;
vertical-align: middle;
text-align: left;
padding:0px;
height:100px;
}
.Skin .SBS .Answers th.SBS2, .Skin .SBS .RepeatHeader td.SBS2 {
@marketinview
marketinview / hideFooterOnEOSPage.html
Last active October 23, 2022 15:05
Qualtrics: Hide Footer on EOS page. Add code to Footer. #qualtrics #js #jq #footer #hide
<script>
Qualtrics.SurveyEngine.addOnload(function() {
if(jQuery("#EndOfSurvey").length > 0) jQuery("#Footer").hide();
});
</script>
@marketinview
marketinview / Excel_Concat.xla
Last active July 9, 2020 19:52
Excel: Concat vb function to concatenate a range of cells. Note: In newer versions of Excel (e.g. Office 365) the built-in TEXTJOIN feature can be used instead. #excel #vb #concatenate
Function Concat(rng As Range, Optional sep As String = ",") As String
Dim rngCell As Range
Dim strResult As String
For Each rngCell In rng
If rngCell.Value <> "" Then
strResult = strResult & sep & rngCell.Value
End If
Next rngCell
If strResult <> "" Then
strResult = Mid(strResult, Len(sep) + 1)
@marketinview
marketinview / showHideNextQonDropDown.js
Last active October 23, 2022 15:11
Qualtrics: Hide/Show Next Question Based On Drop-Down. #qualtrics #js #jq #dropdown #select #hide #show #next
Qualtrics.SurveyEngine.addOnload(function () {
//Hide or show next question based on drop down (select)
var q = jQuery("#"+this.questionId);
var next = q.nextAll('.Separator:first, .QuestionOuter:first'); //next separator & question
var select = q.find('select:first'); //select element
hideShow(select.get(0)); //initialize to support prev button
select.on('change', function() { hideShow(this); });
function hideShow(selEl) {
var selIdx;
@marketinview
marketinview / initializeGraphicSlider.js
Last active October 23, 2022 15:21
Qualtrics: Initialize Graphic Slider. Script initializes graphic slider to a specified value. Supports previous button. #qualtrics #js #jq #initialize #slider #graphic
Qualtrics.SurveyEngine.addOnReady(function() {
//Initialize graphic slider
var init = "1"; //update to initial graphic to show
var qid = this.questionId;
var q = jQuery("#"+qid);
if(q.find('.SSTrack.activated').length == 0) { //not already set (support previous button)
q.find('.handle').css("top", "100px"); //initialize slider
q.find(".SSImage>.SSImage:visible").hide(); //hide default graphic
jQuery(("#Image_QR~"+qid+"@"+init).replace(/(~|@)/g, "\\$1")).show(); //show init graphic
}
@marketinview
marketinview / superscriptSubscript.CSS
Last active October 23, 2022 15:23
Qualtrics: Superscript Subscript CSS. Add this CSS for superscript and subscript (e.g. registered trademark, etc.) to Add Custom CSS. Add text inside <sup> or <sub> tag. #qualtrics #css #sup #superscript #sub #subscript
sub, sup {vertical-align: baseline; position: relative; font-size: 60%;}
sub {bottom: -0.6em;}
sup {top: -0.6em;}
@marketinview
marketinview / multipleItemColsInPGR.css
Last active October 23, 2022 15:23
Qualtrics: Multiple Item Columns in a Pick/Group/Rank Question. Add this CSS to the bottom of the question text to format the Items in a PGR into two columns. #qualtrics #css #pgr #column
<style>
.Skin .PGR .DragAndDrop .Items ul {
columns: 2;
-webkit-columns: 2;
-moz-columns: 2;
}
</style>
@marketinview
marketinview / includeHTML5Video.html
Last active October 23, 2022 16:32
Qualtrics: Include HTML5 Video. Hide Next button until video finishes. Also fixes preview mode issues. #qualtrics #js #jq #next #hide #video #html5
<div style="text-align:center">
<video id="vidId" controls="controls" autoplay="autoplay" width="100%">
<source src="${e://Field/vid_url}" type="video/mp4">
Your browser does not support HTML5 video.
</video>
</div>
@marketinview
marketinview / hideIncompleteBlocksInTOCSidebar.js
Last active October 23, 2022 16:34
Qualtrics: Hide Incomplete Blocks in Table of Contents Sidebar. The script goes in the header. Page transition must be set to "none". #qualtrics #js #jq #toc #hide #header
<script type="text/javascript">
Qualtrics.SurveyEngine.addOnload(function() {
jQuery('#Toc .Incomplete').hide();
});
</script>