Javascript 如何使用sweetalert2链接模式作为测验

Javascript 如何使用sweetalert2链接模式作为测验,javascript,sweetalert,sweetalert2,Javascript,Sweetalert,Sweetalert2,我使用的是sweetalert2,我想用它的链接模式做一个测试,在那里我的用户将输入正确答案的值。 例如: 问题:耶稣是谁? 只有上帝的儿子 2-只有上帝 3-上帝,同时也是上帝的儿子 用户必须在输入文件中输入1、2或3 在我编辑了sweet警报代码并添加了列表代码之后 <ol> <li>only the son of God </li> <li>only God </li> <li>God and at the same

我使用的是sweetalert2,我想用它的链接模式做一个测试,在那里我的用户将输入正确答案的值。 例如:

问题:耶稣是谁? 只有上帝的儿子 2-只有上帝 3-上帝,同时也是上帝的儿子

用户必须在输入文件中输入1、2或3

在我编辑了sweet警报代码并添加了列表代码之后

<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>

  • 只有上帝的儿子
  • 只有上帝
  • 上帝,同时也是上帝的儿子
  • 它没有解释代码,而是显示了代码

     $('.examples .chaining-modals button').on('click', function () {
        swal.setDefaults({
          input: 'text',
          confirmButtonText: 'Next &rarr;',
          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()
        })
      })
    
    $('.examples.chaining modals按钮')。在('click',function(){
    swal.setDefaults({
    输入:“文本”,
    confirmButtonText:“下一个&rarr;”,
    showCancelButton:true,
    进度步骤:['1','2','3']
    })
    变量步骤=[
    {标题:'问题:耶稣是谁?',正文:'只有上帝的儿子
  • 只有上帝
  • 上帝,同时也是上帝的儿子
  • ', {标题:'圣灵是耶稣的灵',文本:'真或假'}, {标题:'圣灵是女人',文字:'是真是假'} ] swal.queue(步骤).then(函数(结果){ swal.resetDefaults() 游泳({ 标题:“全部完成!”, html:'您的答案:'+JSON.stringify(结果)+', confirmButtonText:“可爱!” }).catch(swal.noop) },函数(){ swal.resetDefaults() }) })
    如何使用sweetalert2链接模式作为测验