Sveltekit - Trigger function when new rows added to the Table element

35 views Asked by At

I'd like to trigger my toast function when a new rows added to the table with a sound notification.

    <script>
          function toastTrigger() {
            toast.push('Hello world!');
          }
        </script>
    
    <html>
//table code. with table tag etc.
    {#each Object.entries($catStore.rows) as [key, value], index (key)}
    
    <td on:change={toastTrigger}>{value.name}</td>

My idea is, when I write my new value.name in the table, it triggers the on:change event, but it does not. Sound could be the same as above, but where should I call my on:change? Or any svelte specific solution? Thanks!

0

There are 0 answers