Clear Search Component

I think I’m having a similar issue that Elissa is having.

I tried using this

var search1 = document.getElementById(“MYELEID”).getElementsByTagName(“input”)[0];

search1.value=“”;

And also tried using variations on $(‘#MYELEID input’).val(‘’); //// $(‘#MYELEID input.ui-autocomplete-input’).val(‘’);

All of this code works perfectly in Google Chrome’s console, but when I put it in a snippet that runs off of a search box’s select action it doesn’t clear the search box…

EDIT:

I got it working… I needed to add a delay to the clearing of the box… This works:

setTimeout(() => { $(‘#MYSEARCHBOXID input.ui-autocomplete-input’).val(‘’); }, 10);