How to use modals and toast via javascript


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:

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

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: so stay tuned.

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