Sweetalert: Make user can customize id of confirm/cancel button

Created on 30 Jul 2017  路  4Comments  路  Source: t4t5/sweetalert

I have an idea about make user can customize id of confirm/cancel button, which can make custom function easier.

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.

All 4 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

krishnamraju picture krishnamraju  路  3Comments

voodoo6 picture voodoo6  路  4Comments

VoxelNaut picture VoxelNaut  路  6Comments

Untit1ed picture Untit1ed  路  5Comments

xgqfrms-GitHub picture xgqfrms-GitHub  路  4Comments