在我的調查中,人們被要求列出他們使用的工具,我選擇表單域作為問題型別。無論如何,我希望我的受訪者根據需要添加盡可能多的文本條目,目前文本條目的數量由我預先確定。我想到了類似“添加選擇”按鈕的東西。
到目前為止,我已經找到了它并且它有效:https ://community.qualtrics.com/XMcommunity/discussion/4150/enable-respondent-to-add-extra-response-fields
var that=this.questionId;
jQuery("#" this.questionId " tr.ChoiceRow:not(:lt(1))").hide();
jQuery("<input type='button' id='add' value='Add field' name=' ' />").insertAfter("#" this.questionId " tr.ChoiceRow:last");
jQuery("#add").on('click',function(){
var c= jQuery("tr.ChoiceRow:visible").length;
jQuery("#" that " tr.ChoiceRow:eq(" c ")").show();
});
但是您必須將問題型別更改為“矩陣表”,這是我想避免的。我不知道如何調整代碼以使其適用于表單欄位型別的問題。
謝謝!
uj5u.com熱心網友回復:
該代碼實際上將按鈕添加到錯誤的位置,并且可以對其進行簡化。
這適用于表單:
Qualtrics.SurveyEngine.addOnload(function() {
var cs = jQuery("#" this.questionId " .ChoiceStructure");
cs.find("tr:not(:lt(1))").hide();
cs.append("<input type='button' id='add' value='Add field' name=' ' />");
jQuery("#add").on('click',function(){
var c = cs.find("tr:visible").length;
cs.find("tr:eq(" c ")").show();
});
});
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/425245.html
