semantic-ui modal Close - OK/Cancel Callback

18,341

Solution 1

add a .approve class (or alternative. see http://semantic-ui.com/modules/modal.html#/settings to your 'OK' button to trigger the onApprove callback.

.close class for your Close button.

I have only be using semantic-ui for 2 weeks (and modals for a few hours) so caution required. Thanks mike123 for your answer.

$('.ui.modal.myModal').modal({
        onHide: function(){
            console.log('hidden');

        },
        onShow: function(){
            console.log('shown');
        },
        onApprove: function() {
            console.log('Approve');
            return validateModal()
        }
    }).modal('show');

Solution 2

Is this what you are after:

    $('.selector').modal({
        onHide: function(){
            console.log('hidden');
        },
        onShow: function(){
            console.log('shown');
        }
    }).modal('show');
Share:
18,341
Guddu
Author by

Guddu

Updated on July 24, 2022

Comments

  • Guddu
    Guddu over 1 year

    Is it possible to specify callback functions for Ok and Close button?

    In case of JQuery Modal one could specify the callback functions at the time of initialization using the buttons dictionary. Does Semantic-ui modeal provide for something similar? How do i go for additional logic and close the model after Ok is pressed?