# Clicking on highlighted word should draw a box annotation around it

**URL:** <https://pdfjs.community/t/clicking-on-highlighted-word-should-draw-a-box-annotation-around-it/404>\
**Category:** Technical Support\
**Created:** [December 3, 2020, 10:59am UTC](https://pdfjs.community/t/clicking-on-highlighted-word-should-draw-a-box-annotation-around-it/404 "2020-12-03T10:59:19Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![pratyush](https://avatars.discourse-cdn.com/v4/letter/p/cc9497/32.png) [@pratyush](https://pdfjs.community/u/pratyush)\
**Post date:** [December 3, 2020, 10:59am UTC](https://pdfjs.community/t/clicking-on-highlighted-word-should-draw-a-box-annotation-around-it/404/1 "2020-12-03T10:59:19Z")

</div>

**PDF.js Express Version**

**Detailed description of issue**  
My script highlights a search word on the loaded PDF (see code snippet below). Is it possible to make highlighted words clickable and attach functionalities to it? See below for the expected behavior.

**Expected behaviour**  
My desired functionality is that the user clicks on any highlighted word and a box annotation should appear around that clicked word. Please feel free to recommend any other way to make this happen for the user. I am open to using actual highlight annotations also instead of the search-highlight if that makes it possible to get this functionality.

**Code snippet**  
We are using a script similar to the one below to add highlights to search strings (this was recommended by Logan):

WebViewer(…).then(instance =\> {  
const {docViewer} = instance;

```
docViewer.on('documentLoaded', () => {
   docViewer.setSearchHighlightColors({
     searchResult: new Annotations.Color(0, 0, 255, 0.5),
     activeSearchResult: 'rgba(0, 255, 0, 0.5)'
   });

   instance.searchText('your text here')
})

```

})

---

_[View the full topic](https://pdfjs.community/t/clicking-on-highlighted-word-should-draw-a-box-annotation-around-it/404)._
