How to use the click() function with a Toast

Asked

Viewed 27 times

0

I made a system that when the user enters the index is displayed a materialize Toast, I need that when the user click on it it is redirected to another page, I tried to do as follows but I was not successful;

<script>
    Materialize.toast('Você tem '+retorno+' novas notificação de serviço'+'<div class="material-icons" id="kol">info_outline</div>', 4500, 'blue rounded');

    $( ".rounded" ).click(function() {
      alert( "teste" );
    });
</script>
  • Try with: $(document).on("click", ".rounded", function() {&#xA; alert( "teste" );&#xA; });

  • worked, thank you very much

  • you know tell me why my code didn’t work ?

  • Elements added dynamically uses a different syntax, as I commented above.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.