I have an idea about make user can customize id of confirm/cancel button, which can make custom function easier.
IDs are unnecessary, but you can customize the style of the buttons by using the unique classes swal-button--confirm
and swal-button--cancel
in SweetAlert 2.0.
An ID is really helpful for UI automated testing. Anyone know how to set the ID of buttons on a sweet alert dialog?
This is workaround for someone who are looking for id
onOpen: function() { $('.swal2-confirm').attr('id','btnConfirm');$('.swal2-cancel').attr('id','btnCancel');}
use method onOpen + javascript or jquery to find element with unique class and add attribute id into it.
@zerazeon amazing thank you!
Most helpful comment
This is workaround for someone who are looking for id
onOpen: function() { $('.swal2-confirm').attr('id','btnConfirm');$('.swal2-cancel').attr('id','btnCancel');}
use method onOpen + javascript or jquery to find element with unique class and add attribute id into it.