On modal Close callBack functionality

Hi I have introduced a functionality using which user of remodal can provide an anonymous function to the onClose() function which will get executed when a particular dedicated modal get closed. Let me demonstrate this to you using a code snippet:
-----------------------------------
var homeIntroId = $('[data-remodal-id=homeIntro]').remodal();  //Modal Initialization
    
    homeIntroId.onClose(function(){
        $('[data-remodal-id=homeIntro]').html('');
        $('[data-remodal-id=homeIntro]').attr('data-remodal-id','');
    });
-----------------------------------

Now, Whenever Modal closes either by homeIntroId.close(); or any other way callback function will be called.


Please review it I found this very helpfull and hope this will be helpful to community also.

Regards