【发布时间】:2020-02-07 20:20:38
【问题描述】:
我正在尝试隐藏 Qualtrics 调查中的下一个按钮,直到特定日期/时间(我的代码中的 var 阈值)。我试过了
Qualtrics.SurveyEngine.addOnload(function()
{
var threshold = '2020-02-07T20:00:00.000Z';
var today = new Date();
if(threshold < today) $('NextButton').hide();
else $('NextButton').show();
});
和
Qualtrics.SurveyEngine.addOnload(function() {
function hideEl(element) {
element.hide();
}
var nb = $('NextButton');
var threshold = '2020-02-07 08:12';
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
var time = today.getHours() + ":" + today.getMinutes();
var dateTime = date+' '+time;
hideEl.defer(nb);
if(var dateTime < threshold ) nb.hide();
else nb.show();
});
和
Qualtrics.SurveyEngine.addOnload(function() {
function hideEl(element) {
element.hide();
}
var threshold = '2020-02-07T20:00:00.000Z';
var today = new Date();
var nb = $('NextButton');
hideEl.defer(nb);
$(this.questionId).on('display', function(event) {
if(today<threshold) nb.hide();
else nb.show();
});
});
但无法让它工作。有什么想法吗?
谢谢!!
【问题讨论】:
-
我猜
$('.NextButton')会做到吗? -
A. Meshu 的评论能解决您的问题吗?这只是没有正确的选择器来获取按钮元素的引用的问题吗?
-
感谢您的帮助。添加 .没有做到这一点:/我认为它与日期格式有关,所以我现在正在玩这个逻辑。
标签: javascript qualtrics