Understanding how data-dismiss attribute works in Bootstrap

The hiding functionality is implemented in the modal.js in this way.

this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))

Basically it’s just finding the elements that have the attribute of data-dismiss and the value of modal. Upon click it will hide these elements.

Leave a Comment