simple-svelte-autocomplete icon indicating copy to clipboard operation
simple-svelte-autocomplete copied to clipboard

Programatically clear input

Open jorri11 opened this issue 1 year ago • 1 comments

I have bound a variable to selectedItem. When i clear the bound variable (set it to undefined or null) it does not reflect in the input field. Is there a way to clear it programatically? Reproduction here

jorri11 avatar Sep 28 '23 12:09 jorri11

Based on the comments in #174, I did this:

        const autocompleteClearButton = document.querySelector('span.autocomplete-clear-button');
        if (autocompleteClearButton)
            autocompleteClearButton.click();

This requires the button to be enabled by setting the showClear property.

rtwfroody avatar Nov 11 '23 06:11 rtwfroody