3👍
You can use the ‘shown’ event of the Bootstrap modal to bind your event.
Try:
$('#myModal').on('shown.bs.modal', function () {
// your on click event binding here.
// example of triggering an input.
$('#myInput').trigger('focus');
})
If you want to use it with pure Vanilla JS you can check this to see an alternative implementation.
Source:stackexchange.com