Show SweetAlert2 over Bootstrap modal

流过昼夜 提交于 2019-12-25 00:14:09

问题


I've tried to add a sweetalert component over bootstrap's modal, the problem was that the modal has an atribute 'tabindex' and the focus property was not working as expected, I found a solution that i want to complement, I removed the 'tabindex' attribute and then set focus on the button that I wanted.

If you have another solution, i'd like to know it!

sweet.fire({
          position: 'top',
          title: 'ARE YOU SURE TO UPDATE THIS ITEM?',        
          type: 'info',
          showCancelButton: true,
          confirmButtonColor: '#3085d6',
          cancelButtonColor: '#d33',
          confirmButtonText: 'Continuar',
          cancelButtonText: 'Cancelar',
          reverseButtons: true,
          allowOutsideClick:false,
          onOpen:() => {   
                       document.getElementById("modal_categoria_form").removeAttribute('tabindex');
                       sweet.getConfirmButton().focus();     
           }
         })

来源:https://stackoverflow.com/questions/58806448/show-sweetalert2-over-bootstrap-modal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!