Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1649

How to trigger interactivity on individual items in an #each list in svelte 4 [closed]

$
0
0

I am trying to render a list of clickable items from changing api results (like an autocomplete return). The on:click is not being recognized.

{#if autoCompleteResults.length > 0}<div class="tailwind stuff"><span>Select an Option</span>    {#each autoCompleteResults as result}<div class="tailwind things" on:click={() => functionName(result)}>         {result.name}</div>    {/each}</div>{/if}

I have tried making it various types of elements like buttons, spans, etc. I tried directly console logging from the onclick to make sure it really wasn't triggering. I have tried asking for ai help but none of the options seem to have a working solution.


Viewing all articles
Browse latest Browse all 1649

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>