Easy Way to Clear Search Criteria then Begin New Search?

By: Gary Ownsby | Asked: 05/13/2023
ForumsCategory: General questionsEasy Way to Clear Search Criteria then Begin New Search?
Gary Ownsby asked 2 years ago
I have a search embedded in the before content portion of a view.  The search works fine; however, is there a simple way to give users a button/link to clear the search criteria and do another search without leaving that view? Thank you.  
Attachments
1 Answers
Rob LeVineRob LeVine answered 2 years ago
My suggestion is to have a clear button next to the search button and use jQuery to clear all the fields you want cleared. A really efficient way to do that is to makeup a class name, e.g., clear_search and apply that to all the fields you want cleared and then in the jQuery code you can clear the value to all the fields with that class.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right