You can programmatically trigger actions synchronized with user input in document form fields. You only need to subscribe to the corresponding UI event using [`instance#addEventListener`](https://www.nutrient.io/api/web/NutrientViewer.Instance.html#addEventListener), and the callback you provide will be called whenever the event takes place:

```js

instance.addEventListener("annotations.focus", function (annotationFocusEvent) {
	// Will log the properties of the widget annotation that was just focused.
	console.log(annotationFocusEvent.annotation.toJS());
});

```

Other events that can be used to detect user input in form fields besides [`"annotations.focus"`](https://www.nutrient.io/api/web/NutrientViewer.AnnotationsFocusEvent.html) are [`"annotations.blur"`](https://www.nutrient.io/api/web/NutrientViewer.AnnotationsBlurEvent.html) and [`"annotations.press"`](https://www.nutrient.io/api/web/NutrientViewer.AnnotationsPressEvent.html).

For a complete list of events available for subscription, you can check out the API documentation entry for [`instance#addEventListener`](https://www.nutrient.io/api/web/NutrientViewer.Instance.html#addEventListener).
---

## Related pages

- [Manage bookmarks efficiently with event-driven updates](/guides/web/events/bookmarks.md)
- [Manage annotations effectively with our API](/guides/web/events/annotation.md)
- [Subscribe or unsubscribe to API events](/guides/web/customizing-the-interface/observing-changes-with-events.md)
- [Text Selection](/guides/web/events/text-selection.md)
- [Events and notifications in our JavaScript viewer](/guides/web/events.md)

