How can I remove the asterisk before a question with requirement: force response or put it in white? | Experience Community
Skip to main content
Question

How can I remove the asterisk before a question with requirement: force response or put it in white?

  • January 21, 2026
  • 2 replies
  • 26 views

Forum|alt.badge.img+3

I would like to remove or put the asterisk before a question with a requirement force response in white. So that it is not visible anymore. Has anyone custom CSS code for this? 

2 replies

vgayraud
QPN Level 7 ●●●●●●●
Forum|alt.badge.img+60
  • QPN Level 7 ●●●●●●●
  • January 21, 2026

 


Romanoman
Level 3 ●●●
Forum|alt.badge.img+9
  • Level 3 ●●●
  • January 21, 2026

In case you would be also stuck in a situation where you cannot use the new survey taking experience, it might be a bit trickier - in my case I could not see an existing html marker in the existing structure that would allow this.

 

What worked for me instead is the combination of the JS in the header and global CSS - JS to look for the question with the forced response, adding a marker, then using the CSS to add the red asterisk:

Below you can find the individual parts that worked for me.

CSS in the Survey/Look and feel/Style/Custom CSS:

.Skin .QuestionOuter.is-required legend .QuestionText:first-child::before {
content: "* ";
color: #d0021b;
font-weight: 700;
}

JS in the Survey/Look and feel/General/Header (added directly under the source)

<script>
(function () {
// ---------- helpers ----------
function markAllRequired() {
// Prefer the Qualtrics registry if available
var qids = [];
if (window.Qualtrics && Qualtrics.SurveyEngine && Qualtrics.SurveyEngine.Registry) {
try { qids = Object.keys(Qualtrics.SurveyEngine.Registry); } catch (e) { qids = []; }
}

// Fallback: derive QIDs from DOM if registry is empty/not ready
if (!qids.length) {
var nodes = document.querySelectorAll('.QuestionOuter[id^="QID"]');
qids = Array.prototype.map.call(nodes, function (n) { return n.id; });
}

// Iterate all questions found
qids.forEach(function (qid) {
var isForced = false;
try {
var qd = Qualtrics.SurveyEngine.QuestionData.getInstance(qid);
var info = qd && qd.question && typeof qd.question._getQuestionInfo === 'function'
? qd.question._getQuestionInfo()
: null;
var settings = info && info.Validation && info.Validation.Settings;
isForced = !!(settings && (settings.ForceResponse === "ON" || settings.ForceResponseType === "ON"));
} catch (e) {
// ignore and leave isForced=false
}

var node = document.getElementById(qid);
if (node) node.classList.toggle('is-required', isForced);
});
}

function whenEngineReady(cb, tries) {
tries = tries || 0;
var ready = !!(window.Qualtrics && Qualtrics.SurveyEngine && (Qualtrics.SurveyEngine.Registry || true));
// We only need QuestionData/getInstance to work; Registry is preferred but not mandatory.
if (ready || tries > 40) { cb(); return; }
setTimeout(function(){ whenEngineReady(cb, tries + 1); }, 200);
}

// ---------- run ----------
var run = (function () {
var t;
return function () { clearTimeout(t); t = setTimeout(markAllRequired, 80); };
})();

// Initial run when the engine is (likely) ready
whenEngineReady(run);

// Run on load and after DOM mutations (display logic, pagination, etc.)
window.addEventListener('load', run);
new MutationObserver(run).observe(document.body, { childList: true, subtree: true });

// If lifecycle hooks are present, use them too (they're no-ops if not available)
try { Qualtrics.SurveyEngine.addOnReady(run); } catch(e){}
try { Qualtrics.SurveyEngine.addOnload(run); } catch(e){}
})();
</script>