jQuery now included by default in Qualtrics | XM Community

jQuery now included by default in Qualtrics

  • 14 December 2017
  • 11 replies
  • 724 views

Userlevel 7
Badge +7
This is a great piece of information I was informed f today, turns out, a few months ago jQuery was added to Qualtrics as a default!

The one caveat being that you need to use jQuery instead of $ to reference it (obviously done to not break legacy code that relies on prototype.js.

More details here: https://www.qualtrics.com/support/survey-platform/survey-module/question-options/add-javascript/#Guidelines

Thought I would share, since as far as I know this wasn't ever really "announced", but it is super helpful.

Anyone else that didn't know this had been added?

11 replies

Hi @AnthonyR, thanks for sharing, I didn't know either. This is great news, one less step when doing squirrelly things with JavaScript 🙂
Userlevel 3
Badge +4
What if the different websites/platforms you run Qualtrics Site Intercepts on, are depending on different version of JQuery libs? Wouldn't this Qualtrics JQuery conflict with that? Or would it be okay because Site Intercept is iframed and thus not conflicting with the JQuery version on your website?
Userlevel 7
Badge +7
@AbdulDezkam That is correct, it will be contained to the iFrame and shouldn't give you any trouble.
Userlevel 7
Badge +27
There is a flip-side to this announcement. In the next few months Qualtrics will announce that Prototypejs will be eliminated, and then it will go away 3 to 6 months after the announcement. I expect it will be gone by Q4 2018 or shortly thereafter.

So, my advice is to start planning on updating your scripts to use jQuery instead of Prototypejs. We have some surveys that are fielded throughout the entire year, so I've already been updating those so that we don't have to make changes in the midst of fielding. Also, we are using jQuery for all new scripts.

Background: In mid-November, Qualtrics made a JFE update that unintentionally broke parts of Prototypejs (the namespace went missed, as well as layout and form functions). This resulted in a lot of communication (and some miscommunication) between myself, our Client Success Manager, Support and Engineering. Since that time, Qualtrics has been working to fix what was broken (it appears they aren't quite there yet). Anyway, during the process they let me in on the longer range plan for Prototypejs.
Userlevel 6
Badge +7
> @TomG said:
> There is a flip-side to this announcement. In the next few months Qualtrics will announce that Prototypejs will be eliminated, and then it will go away 3 to 6 months after the announcement. I expect it will be gone by Q4 2018 or shortly thereafter.
>
> So, my advice is to start planning on updating your scripts to use jQuery instead of Prototypejs. We have some surveys that are fielded throughout the entire year, so I've already been updating those so that we don't have to make changes in the midst of fielding. Also, we are using jQuery for all new scripts.
>
> Background: In mid-November, Qualtrics made a JFE update that unintentionally broke parts of Prototypejs (the namespace went missed, as well as layout and form functions). This resulted in a lot of communication (and some miscommunication) between myself, our Client Success Manager, Support and Engineering. Since that time, Qualtrics has been working to fix what was broken (it appears they aren't quite there yet). Anyway, during the process they let me in on the longer range plan for Prototypejs.

Hi Tom,

We just wanted to clarify a few things here. You will still be able to load the prototype.js file yourself, if you would like. The only thing that will be changing is that the prototype.js file will no longer be included by default.

Hopefully that helps clear things up a bit!
Userlevel 7
Badge +27
@Emily,

I realize we could load prototype ourselves, but that seems risky to me. As users, we have no way to test that exact configuration in advance. If there were any issues or conflicts, we wouldn't find out until the day prototype is removed. I was in that position back in November when parts of prototype were disabled and it wasn't fun. Besides, since jQuery is the direction of the future, with plenty of time, it seems best just to get on with it...and I say that as someone who has a large library of Qualtrics scripts that use prototype.
Userlevel 7
Badge +7
@TomG Thanks for sharing. I suppose it is time to start updating my pretty extensive library of scripts as well!
Userlevel 7
Badge +7
Though old, this is still mostly relevant for anyone working to update from prototype to jquery: https://andykdocs.de/development/JavaScript/Migrating+from+PrototypeJS+to+jQuery/files/Prototype-JS-to-jQuery-Migration-Cheat-Sheet-V1-April-2010.html
Userlevel 7
Badge +27
Thanks for the cheat sheet @AnthonyR .

Here is something that had me flummoxed for awhile, so it may help others. jQuery doesn't like tildes (~) in element id strings. They have to be escaped with `\\\\`. For example:

`var el = jQuery('#QR\\\\~'+qid+'\\\\~'+choice);`

https://www.qualtrics.com/community/discussion/266/jquery-now-included-by-default-in-qualtricsThank you thank you thank you!! You just have no idea how this has helped me. Had been using $ instead of JQuery and was going crazy of why it wouldn't work. Finally saw your post... Thank you thank you again.

Badge +1

https://community.qualtrics.com/XMcommunity/discussion/comment/991#Comment_991Got his after 1 hour of madness! Thanks mate.

Leave a Reply