You should not associate such events!
Are you using some kind of framework like React or even jQuery? If you use the latter, for example, link like this (in JS, not HTML):
$('#your-id').on('click', () => Detail.add());
If you do not, follow these steps:
document.getElementById('your-id').onclick = () => Detail.add();
However, if this is an exception, and you really want to export something, you can set it for the window object:
window.Detail = Detail;