I am thinking it might have something to do with how our Vanity URL was setup. Could that potentially be a culprit?
Not seeing the error anymore or anything else in the console (I would expect to see the string 'test').
Qualtrics.SurveyEngine.addOnload(function() { /*Place your JavaScript here to run when the page loads*/ }); Qualtrics.SurveyEngine.addOnReady(function() { console.log('test'); }); Qualtrics.SurveyEngine.addOnUnload(function() { /*Place your JavaScript here to run when the page is unloaded*/ });
Since I can't delete the post, it has to do with the fact the switch statement uses strict comparison while the if statement (==) doesn't. I didn't realize that the qualtrics method `getSelectedChoices()` returns a string and not an integer. Wrapping parseInt() i.e `parseInt(that.getSelectedChoices()[0], 10);` fixed the issue.
Well that's good to know...I am wondering how some (very small minority) of my participants were able to get to the survey, but were having issues with the JS being triggered. Any ideas?
I was actually was able to get it to work...seems like I needed even more padding than I originally thought. However, it still doesn't look great on mobile...anyway to get this to be mobile responsive? Btw, I had to increase the right padding to 200px.
Interesting...why would the jQuery(document).ready(function(){}); throw this off? I thought this function made it safer to execute jQuery. Also, the sum boxes do not align with the input boxes...any help here is greatly appreciated!
Actually, I tried adding your piece of code and it didn't work. My full code and the URL for testing is below: Qualtrics.SurveyEngine.addOnReady(function() { jQuery(document).ready(function() { var inputs = jQuery('[type=text]'); inputs.width("150px"); jQuery("#"+this.questionId+" .SumTotal input[type='text']").css("color","black"); }); }); https://dimensional.co1.qualtrics.com/jfe/preview/SV_bpcJTINt5fqOfDD?Q_SurveyVersionID=current&Q_CHL=preview
Great. Thanks! I have one last part of this question...I have used JS to expand my input boxes on the same question, but the sum boxes do not line up. How do I get this corrected? My code is: Qualtrics.SurveyEngine.addOnReady(function() { jQuery(document).ready(function() { var inputs = jQuery('[type=text]'); inputs.width("150px"); }); });
Thanks Tom. Instead of return the number of the choice, is there anyway to have it return the text? i.e. if Salesforce was choice 1 it would assign CRM variable the string of Salesforce and not the value of 1.
Already have an account? Login
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.