Skip to content

Snippets / JS

JS

Delete input on search filter field when click

K krackalaka · 163 views · Updated 1 year ago
If you want to location filter field to autowipe when the user clicks on the field to enter a new location, instead of having to backspace the full text.
You can use JavaScript to add a focus event, e.g. Templates/widgets/search-form/location-filter.php Copy to child theme
jQuery( $ => { $('.ts-filter-wrapper .ts-inline-filter:has(.inline-user-location)').on( 'focus', '.inline-input', e => { e.target.value = ''; e.target.dispatchEvent( new Event('input') ); } ); } );
JS · 1 lines

Discussion

Ask a question or share how you used this.

Log in to join the discussion.

No comments yet — be the first.

Voxel Guide assistant
Ask about snippets, addons & how-tos

Hey — how can I help?

I can dig through the library for snippets, addons, and tutorials.

AI can be wrong — double-check anything important.