Programming Tips - Bootstrap: stop audio and video when used closes a modal dialog

Date: 2019jul8 Language: javaScript Library: Bootstrap, jquery Q. Bootstrap: stop audio and video when used closes a modal dialog A.
// Assuming `dlg` is a variable holding your dialog dlg.on('hidden.bs.modal', function () { const found = dlg.find('audio,video'); if (found.length > 0) { found[0].pause(); } });