TomG
I tried to hide and then conditionally show the Next button, but my syntax seems wrong. Any idea?
```
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
this.hideNextButton();
var questionID = this.questionId;
var textbox =$('QR~' + questionID);
function countWords(s) {
s = s.replace(/\\n/g,' '); // newlines to space
s = s.replace(/(^\\s)|(\\s$)/gi,''); // remove spaces from start + end
s = s.replace(/[ ]{2,}/gi,' '); // 2 or more spaces to 1
if(s == ''){
return 0;
} else {
return s.split(' ').length;
}
}
textbox.onkeyup = function(e) {
var aa = countWords(textbox.value);
Qualtrics.SurveyEngine.setEmbeddedData("ED1", aa);
}
if (aa >= 14) {
this.showNextButton();
}
});
```
duc_pq ,
this.showNextButton();is inside the onkeyup function, so 'this' no longer refers the to Qualtrics question object where the showNextButton() function resides.
At the beginning of the addOnReady function add
var qobj = this;then use
qobj.showNextButton();in the onkeyup function.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.