Home >Web Front-end >JS Tutorial >Bootstrap Modal Event Not Fired When Modal is Shown/Hidden
Use jQuery (3.2.1).
In the Modal ofBootstrap (v4-alpha), if the Modal exists .fade
, then the shown.bs.modal
and hidden.bs.modal
events The callback function will not be triggered normally.
But the triggering of the show.bs.modal
and hide.bs.modal
events is normal.
The difference between these two events is immediately and wait for CSS transitions to complete.
Dynamically add .fade
class before setting the event listener:
<code>$ -> registerModal = $('#registerModal') registerModal.addClass('fade') registerModal.on('hidden.bs.modal', -> $(this).find('input').val('') )</code>
The above is the detailed content of Bootstrap Modal Event Not Fired When Modal is Shown/Hidden. For more information, please follow other related articles on the PHP Chinese website!