Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

sweetalert close on custom button click

swal.close()
Comment

sweet alert add custom button

    $(document).on('click', '.SwalBtn1', function() {
        //Some code 1
        console.log('Button 1');
        swal.clickConfirm();
    });
    $(document).on('click', '.SwalBtn2', function() {
        //Some code 2 
        console.log('Button 2');
        swal.clickConfirm();
    });

$('#ShowBtn').click(function(){
    swal({
        title: 'Title',
        html: "Some Text" +
            "<br>" +
            '<button type="button" role="button" tabindex="0" class="SwalBtn1 customSwalBtn">' + 'Button1' + '</button>' +
            '<button type="button" role="button" tabindex="0" class="SwalBtn2 customSwalBtn">' + 'Button2' + '</button>',
        showCancelButton: false,
        showConfirmButton: false
    });
 });
Comment

PREVIOUS NEXT
Code Example
Javascript :: nodejs mysql insert object query 
Javascript :: install aos angular 10 
Javascript :: column.footer jquery 
Javascript :: js add to array conditionally 
Javascript :: prependchild in javascript 
Javascript :: bootstrap 5.1 3 tooltip not working 
Javascript :: loop array in javascript 
Javascript :: iframe content fetching 
Javascript :: mongodb update many 
Javascript :: get date js 
Javascript :: react native slow performance after load iamges 
Javascript :: javascript regex check phone number 
Javascript :: palindrome rearranging javascript 
Javascript :: sort object by key value javascript 
Javascript :: multiple line string in jquery 
Javascript :: how to change style of an element using javascript 
Javascript :: angular access service in console 
Javascript :: find object in array javascript with property 
Javascript :: return only specific attributes when making query mongoose 
Javascript :: js array set value at index 
Javascript :: js onchange input value event listene 
Javascript :: javascript base 10 to base 2 
Javascript :: javascript origin url 
Javascript :: js string does not contain 
Javascript :: add event listener on width screen resize 
Javascript :: dynamic style react 
Javascript :: javascript absolute path 
Javascript :: Set timeouts to XMLHttpRequests in javascript 
Javascript :: javascript get parent element height javascript 
Javascript :: jquery check if exist 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =