Successfully added
Website Feature Development
by Patrik
Clear Input Field on Action
To clear an input field, we need to set the value to an empty string. The following script shows how to clear an input field when clicking on a link.
<a href="#" onclick="clearDropdownSearch(this);">
// ...
function clearDropdownSearch(aTag) {
const inputTag = aTag.parentElement.getElementsByTagName("INPUT")[0];
inputTag.value = "";
// ...
}
Additional resources to clear an input field:
Snippset
Referenced in:
Comments