Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Trigger live search when clicked
This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko 11 months, 2 weeks ago.
- AuthorPosts
- September 18, 2023 at 3:55 am #45407
Hi,
We are using a Search for our products.
The URL says SERVICES, but we are actually using WooCommerce products.
And we are almost set.We just want to show our products instantly when they click on the search bar.
I set a minimum character to 0 to trigger the live search.
It works, but not initially.
After I type a space or anything, your live search starts working.
But we want it to show popular products right after they click and then keep changing products when they start to type words. That’s already working.Just need help with triggering live search instantly when they click.
Like this website https://www.taskrabbit.com/
I contacted your presale support. They said it is quite easy with a few lines of custom code after we purchase the paid version.And if you have any way to control or sort the products when they click, please also leave a guide for me.
Thanks in advance
September 18, 2023 at 2:25 pm #45420Hi,
Thank you very much for the details! Indeed, this should be doable with a small custom code snippet.
Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
add_action('wp_footer', 'asp_add_footer_script', 99999); function asp_add_footer_script() { ?> <script> jQuery(function($){ $('input.orig').one('click', function(e){ $(this).get(0).dispatchEvent(new Event('input')) }); }); </script> <?php }
If you need help with this just let me know!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.