--- title: Change the behavior when a result link is clicked slug: '2770' canonical_url: https://docs.coveo.com/en/2770/ collection: javascript-search-framework source_format: adoc --- # Change the behavior when a result link is clicked You may want to have different behaviors when an end user opens an item in the result list, depending on what type of item was clicked. To do so, create custom [result templates](https://docs.coveo.com/en/413/). Also specify a custom [`onClick`](https://coveo.github.io/search-ui/components/resultlink.html#options.onclick) function for the [`ResultLink`](https://coveo.github.io/search-ui/components/resultlink.html) component in the [`init`](https://coveo.github.io/search-ui/globals.html#init) (or [`options`](https://coveo.github.io/search-ui/globals.html#options)) call of your search interface (see [Configuring components](https://docs.coveo.com/en/346#configuring-components)). **Example** You want to execute custom logic such that clicking Gmail Threads opens a `Quickview`, and clicking other results executes custom code. You create two result templates: * The first result template forces the `ResultLink` to open a `Quickview` for results whose `@gmailthreadid` [field](https://docs.coveo.com/en/200/) value is defined. * The second result template forces the `ResultLink` to open the corresponding page in a new browser tab. This result template handles all items that are **not** Gmail Threads (that is, it's the default result template). ```html