I'd like to run a function just before a <div>
element is removed from document.
What eventListener
can I add to the <div>
element?
If there's no exact event to do it, then how can I bind a function to the <div>
element when it's going to be removed? I tried the below, but they didn't work
$('#divToRemove').on('beforeunload', handler);
divToRemove.addEventListener('onbeforeunload', handler);
Any answer will be very appreciated.