Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programatically clear input #215

Open
jorri11 opened this issue Sep 28, 2023 · 1 comment
Open

Programatically clear input #215

jorri11 opened this issue Sep 28, 2023 · 1 comment

Comments

@jorri11
Copy link

jorri11 commented Sep 28, 2023

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

@rtwfroody
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants