How to use modals and toast via javascript

Hello!
I cannot understand how to use modals and toast via javascript.
For example form validation. If email already registered I want to show toast, but how to show it using JavaScript without using:

<p>
  <a class="btn waves-button waves-effect" data-toggle="toast" title="Simple toast with some text">Toggle Toast</a>
</p>

I want to:

    if(!validaEmail) {
       //show toast 
       // break submit
    }

hi @banzaiii

current toast is mainly to provide the styles, and the javascript side of it certainly needs improvement in the future. we are currently working on improving the javascript side of the project: https://github.com/Daemonite/material/tree/js-update so stay tuned.

meanwhile there is another discussion on toast here: Prompt a toast to come up via a function

1 Like