Javascript Insertion in End of Survey | XM Community
Skip to main content
Question

Javascript Insertion in End of Survey

  • November 15, 2024
  • 2 replies
  • 94 views

Forum|alt.badge.img+2

How do I add this code to my End of Survey?

 

function addPrintBlur() {
  const style = document.createElement('style');
  style.textContent = `
    @media print {
      body {
        filter: blur(10px); /* Adjust the blur intensity as needed */
      }
    }
  `;
  document.head.appendChild(style);
}

// Call the function to add the CSS rule
addPrintBlur();

2 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • November 15, 2024

You can add javascript inside a script tag in an addOnload function in your end of survey message.  However, it would be easier just to add the style tag to your end of survey message:

End of survey message text here.
<style>
@media print {
body { filter: blur(10px); }
}
</style>

 


Forum|alt.badge.img+2

Thank you for this information!!!