I have the below java script code to measure the time spent on hovering a flip-card (text question) in Qualtrics. I am trying to get the results of the time in seconds and unable to figure where the results are stored.
Any help would be appreciated.
In Qualtrics $ refers to prototypejs. Use jQuery (
e.g., jQuery('.flip-card')).
Thank you TomG
In Qualtrics $ refers to prototypejs. Use jQuery (
e.g., jQuery('.flip-card')
).
Sorry but I am a newbee to JS and JQuery. I have unsure what is the solution here. Do you mean replace every $ with jQuery? Or do you mean use jQuery() covering all the functions?
Thank you very much
Since Qualtrics framework also use the $ for its own scripting. So if two different frameworks are using the same shortcut, one of them might stop working. Just to resolve this issue jQuery has created one method called noConflict()
. This method releases the hold on the $ shortcut identifier, so that other scripts can use it.
Example to use:
var jq = $.noConflict();
jq('.flip-card')
So wherever $ is mentioned in jQuery code you can replace it with jq.
Since Qualtrics framework also use the $ for its own scripting. So if two different frameworks are using the same shortcut, one of them might stop working. Just to resolve this issue jQuery has created one method called noConflict()
. This method releases the hold on the $ shortcut identifier, so that other scripts can use it.
Example to use:
var jq = $.noConflict();
jq('.flip-card')
So wherever $ is mentioned in jQuery code you can replace it with jq.
Thank you very much for answering.
I am currently doing the similar thing, during to record the hover time as an embedded data (I posted the css, div and js). However, I found that the js never worked. It seems that function ‘hover’ is not working properly.
Is it because I need some particular jQuery libraries to be loaded at somewhere?
Please confirm only hover code is not working or there are other jquery code which are also not working? Because if you are using simple layout then other code will also not work. Simple layout does not support JS.
If you are not using simple layout. So do one thing, instead of saving it in embedded data, try to save it on open text box on same page and then hide that text box question through JS.
Please confirm only hover code is not working or there are other jquery code which are also not working? Because if you are using simple layout then other code will also not work. Simple layout does not support JS.
In fact, the code does not work since first line var jq = $.noClonflict();
However, if I add <script src="https://code.jquery.com/jquery-3.7.0.js"></script> to the top of the question block (html view), the first line will work pass but again stop working from the line with hover function.
You should remove the embedded field and save hovertime under text box.
You should remove the embedded field and save hovertime under text box.
I have been trying for many times but function ‘hover’ still seems not working at all.
Is it because Qualtrics only allow in-built functions to trigger particular functions in js? For instance, question click().
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.