我正在Qualtrics上创建一个调查,我希望在调查人员对矩阵的最后一个问题做出选择后,自动前进到下一页。我有一段javascript代码,可以在点击一个单选题后自动前进,但我需要编辑它,以便在点击矩阵表中的最后一个单选题时自动前进:
var that = this;
this.questionclick = function(event,element){
if (element.type == 'radio') {
that.clickNextButton();
}
}
发布于 2015-06-09 05:09:36
这可以通过使用API中的另外两个方法以编程方式完成: getChoices()和getSelectedChoices()。这允许我们编写灵活的代码,无论选择的顺序是什么,或者显示了多少选项,这些代码都可以工作。
var that = this;
var choices = this.getChoices( "radio" ).length;
this.questionclick = function( event, element ){
var selected = that.getSelectedChoices().length;
if ( choices == selected ) {
that.clickNextButton();
}
}
我们将选择的数量与答案的数量进行比较,并且只在每条语句得到回答后才进行处理。
https://stackoverflow.com/questions/29801767
复制相似问题