q.addClass('multiple');
}
} else if (type === 'text' || type === "email") {
- $(holder).append('<input type="' + type + '" name="answer" class="focusme" placeholder="' + $(this).attr('placeholder') + '" />')
+ $(holder).append('<input required type="' + type + '" name="answer" class="focusme" placeholder="' + $(this).attr('placeholder') + '" />')
} else if (type === 'textarea') {
- $(holder).append('<textarea name="answer" class="focusme" placeholder="' + $(this).attr('placeholder') + '"></textarea>')
+ $(holder).append('<textarea required name="answer" class="focusme" placeholder="' + $(this).attr('placeholder') + '"></textarea>')
}
$(q).find('.answers').append($(holder));
function validateMulti(button) {
var question = $(button).closest('.question');
+ if ($(question).find('input').length > 0) {
+ var input = $(question).find('input');
+ if (!$(input).get(0).checkValidity()) {
+ $(input).get(0).reportValidity()
+ return;
+ }
+ }
var ok = true;
$(question).find('.answer').each(function () {
if (($(this).attr('data-correct') == '1') != $(this).hasClass('active')) {