Title: Trigger search with javascript
Last modified: June 14, 2023

---

# Trigger search with javascript

 *  Resolved [michaelpdi](https://wordpress.org/support/users/michaelpdi/)
 * (@michaelpdi)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/trigger-search-with-javascript/)
 * Is there a way to trigger the auto search box with a js code? Because I’m having
   elements with text, when they get clicked, the innerHTML gets added to the search
   field, but I have no idea how to trigger to open the autosearch results.
   Best
   regardsMichael

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [wpdreams](https://wordpress.org/support/users/wpdreams/)
 * (@wpdreams)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/trigger-search-with-javascript/#post-16821061)
 * Hi,
 * Sure! The easiest way to trigger is by using the ASL.api, like this:
 *     ```wp-block-code
       ASL.api(1, 'searchFor', 'phrase')
       ```
   
 * This will trigger the search after adding ‘phrase’ to the search input.
 * All the best,
   Ernest
 *  Thread Starter [michaelpdi](https://wordpress.org/support/users/michaelpdi/)
 * (@michaelpdi)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/trigger-search-with-javascript/#post-16822126)
 * [@wpdreams](https://wordpress.org/support/users/wpdreams/) Thank you so much,
   it worked. 
   I wanted to say that I tested all of the search plugins available
   and yours was the best of all.
 * Best regards
   Michael
 *  Plugin Author [wpdreams](https://wordpress.org/support/users/wpdreams/)
 * (@wpdreams)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/trigger-search-with-javascript/#post-16823859)
 * Great 🙂 Thank you very much for your kind words!
 * Feel free to [rate the plugin](https://wordpress.org/support/plugin/ajax-search-lite/reviews/#new-post)
   if you like it, it helps us greatly.
 * All the best,
   Ernest

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Trigger search with javascript’ is closed to new replies.

 * ![](https://ps.w.org/ajax-search-lite/assets/icon-256x256.png?rev=3192672)
 * [Ajax Search Lite - Live Search & Filter](https://wordpress.org/plugins/ajax-search-lite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-search-lite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-search-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-search-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-search-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-search-lite/reviews/)

## Tags

 * [search results](https://wordpress.org/support/topic-tag/search-results/)
 * [trigger](https://wordpress.org/support/topic-tag/trigger/)

 * 3 replies
 * 2 participants
 * Last reply from: [wpdreams](https://wordpress.org/support/users/wpdreams/)
 * Last activity: [2 years, 11 months ago](https://wordpress.org/support/topic/trigger-search-with-javascript/#post-16823859)
 * Status: resolved