我正在使用sweetalert2,并希望从其链接模式中进行测验,我的用户将在其中输入正确答案的值。 例如:
问题:耶稣是谁? 1-只有神的儿子 2-只有上帝 3-上帝,同时也是上帝的儿子
用户将必须在输入文件中输入1或2或3。
我编辑了甜蜜警报代码并添加了列表代码
<ol>
<li>only the son of God </li>
<li>only God </li>
<li>God and at the same time the son of God</li>
</ol>
它显示代码而不是Sweetalert2解释代码。
$('.examples .chaining-modals button').on('click',function () {
swal.setDefaults({
input: 'text',confirmButtonText: 'Next →',showCancelButton: true,progressSteps: ['1','2','3']
})
var steps = [
{title: 'Question : Who is Jesus ?',text: '<ol><li>only the son of God </li> <li>only God </li> <li>God and at the same time the son of God</li> </ol>'},{title: 'The Holy Spirit is the Spirit of Jesus',text: 'True or False'},{title: 'The Holy Spirit is a woman',text: 'True or False'}
]
swal.queue(steps).then(function (result) {
swal.resetDefaults()
swal({
title: 'All done!',html: 'Your answers: <pre>' + JSON.stringify(result) + '</pre>',confirmButtonText: 'Lovely!'
}).catch(swal.noop)
},function () {
swal.resetDefaults()
})
})
如何使用sweetalert2链接模式作为测验?