Execute function after search result click

1802
5
Jump to solution
03-27-2017 12:57 AM
chrisweaves
New Contributor II

I was after a little help on something I've been stuck on and was wondering if someone could give me a little guidance? 

Basically, I want to be able to run a specific JS function after the user clicks on a result from the search widget list of results, the use case would be: a user clicks in the search widget and enters some text, the suggested results popup up below the widget and as soon as a user clicks on a result this calls a function that I have written (hopefully with an id that relates back to the clicked search result).

Thanks, Chris.

0 Kudos
1 Solution
5 Replies
FC_Basson
MVP Regular Contributor

You can use the "select-result" event to run your own function: Search | API Reference | ArcGIS API for JavaScript 3.20 

chrisweaves
New Contributor II

This is the correct answer for 3.x, I can only mark one as correct and that was the answer below as I'm working with JS API 4,3 I would mark them both correct if it was possible.  Thanks for your help!

0 Kudos
FC_Basson
MVP Regular Contributor

No problem at all!

0 Kudos
chrisweaves
New Contributor II

Thanks for your response, sorry, I forgot to mention I'm using API 4.3 and from what I can see your solution is for API 3.x.  I will look for an API 4.3 equivalent, thanks again.

0 Kudos