Bootstrap event real example code

The event fires immediately when the show instance method is called means this event works when the modal is about to be displayed. The code executed in the call back method of event will perform first then the modal will be displayed.

Answers 1
  • Remove text from element in modal on event

    <button type="button" class="btn btn-success"> Open Modal  </button>
    <div class="modal fade" id="myModal">
    	<div class="modal-dialog modal-dialog-centered" role="document">
    		<div class="modal-content">
    		    <div class="modal-body">
                    <div id="response">  Lorem ipsum text </div>  
    <script src=""></script>
    <link rel="stylesheet" href="" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
    <script src=""></script> 
            $('button').on('click', function(){
            $('#myModal').on('', function () {

    This code snippet will empty or remove text from invalid-feedback element and remove is-invalid class from form-control before showing the login modal 

  • Back to code snippet queries related bootstrap