Topic: EVENT TOAST
                  
                  Pellegrino
                  priority
                  asked 10 months ago
                
I don't understand why the event isn't intercepted. I don't understand why the event is not intercepted. everything seems correct
    var tst =null; 
            $(document).ready(function(){
                var eltoast = document.getElementById('tst');
                tst = mdb.Toast.getOrCreateInstance(eltoast);
                console.log(tst);
            $('#chiudi').click(function(){
                tst.hide();
            }); 
            $('#apri').click(function(){
                tst.show();
            });     
            $(tst).on('hidden.mdb.toast',function() {
                alert('ddd');
            });
        });
                
                  
                      
                      Kamila Pieńkowska
                      staff
                        answered 10 months ago
                    
Please, switch your listener to:
  $(document).on('hide.bs.toast',function() {
    alert('ddd');
  });
It will work.
                      
                      Pellegrino
                      priority
                        answered 10 months ago
                    
I attach the complete code. According to your API documentation of the TOAST object the event should be captured on "hide.mdb.toast"
ananan
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet"/>
<link href="jquery/MDB8/css/mdb.min.css" rel="stylesheet"/>
<script  src="jquery/jquery-1.11.0.min.js"> </script>
</head>
    
        
            
            MDBootstrap
            11 mins ago
            
        
    <div class="toast-body">Hello, world! This is a toast message.</div>
</div>
<button id="chiudi" class="btn btn-primary">CHIUDI</button>
<button id="apri" class="btn btn-danger">APRI</button>
    <script>
        var tst =null;
        $(document).ready(function(){
            var eltoast = document.getElementById('tst');
            tst = mdb.Toast.getOrCreateInstance(eltoast);
            console.log(tst);
            $('#chiudi').click(function(){
                tst.hide();
            });
            $('#apri').click(function(){
                tst.show();
            });
            $(tst).on('hide.mdb.toast',function() {
                alert('ddd');
            });
        });
    </script>
    <script type="text/javascript"  src="jquery/MDB8/js/mdb.umd.min.js"> </script>
</body>
                    
                      
                      
                      Kamila Pieńkowska
                      staff
                        answered 10 months ago
                    
Please craete a snippet that demonstrates the issue. A HTML part is needed aside of JS. And describe what actions you expect and what you get instead.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Priority
 - Premium support: Yes
 - Technology: MDB Standard
 - MDB Version: MDB5 8.1.0
 - Device: pc
 - Browser: chrome
 - OS: windows
 - Provided sample code: No
 - Provided link: No