# Select PDF annotations using JavaScript

Nutrient Web SDK enables you to select annotations using the built-in user interface (UI) or programmatically.

Set the `enableClipboardActions` property to `true` to use keyboard shortcuts. For more information, refer to the [API reference](https://www.nutrient.io/api/web/NutrientViewer.Configuration.html#enableClipboardActions) guide.

## Using the built-in UI

There are multiple methods for selecting annotations directly through the UI.

To select a single annotation, left-click the desired annotation within the viewport.

To select multiple annotations, use one of the following methods:

- Click the **Select Multiple Annotations** toolbar item, left-click, and draw a rectangle with your mouse around all the annotations you want to select.

- Select a single annotation by clicking it and then press **Shift** to select more annotations one by one.

- Press **Control** (Windows) or **Command** (macOS), left-click, and draw a rectangle with your mouse around all those annotations that you want to select.

- Press **Control-A** (Windows) or **Command-A** (macOS) to select all annotations on the page.

### Grouping annotations

Grouping multiple annotations enables you to select the same set of annotations in the future and perform actions on all of them in one go. After grouping annotations, select the whole group by clicking only one of the annotations in the group.

Group the selected annotations in one of the following ways:

- Click the **Group** toolbar item.

- Press **Control-G** (Windows) or **Command-G** (macOS).

Ungroup the annotations in one of the following ways:

- Click the **Ungroup** toolbar item.

- Click one of the annotations in the group, and press **Control-Shift-G** (Windows) or **Command-Shift-G** (macOS).

### Modifying multiple annotations

After selecting multiple annotations, perform one of the following actions:

- Drag all the selected annotations to a new location on the page.

- Copy all the selected annotations by pressing **Control-C** (Windows) or **Command-C** (macOS).

- Paste all the selected annotations by pressing **Control-V** (Windows) or **Command-V** (macOS).

- Duplicate all the selected annotations by pressing **Control-D** (Windows) or **Command-D** (macOS).

- Delete all the selected annotations by pressing **Del** (Windows) or **Command-Backspace** (macOS).

## Programmatically

To select annotations, pass the annotation IDs to the [`setSelectedAnnotations`](https://www.nutrient.io/api/web/NutrientViewer.Instance.html#setSelectedAnnotations) method:

```js

instance.setSelectedAnnotations(
  NutrientViewer.Immutable.List(["annotationsOrAnnotationsIds"])
);

```

To deselect the currently selected annotations, pass `null` to the `setSelectedAnnotations` method.
---

## Related pages

- [Add image annotations to PDFs using JavaScript](/guides/web/annotations/create-edit-and-remove/add-image.md)
- [Annotation flags](/guides/web/annotations/annotation-flags.md)
- [Cut, copy, paste, and duplicate annotations in PDF using JavaScript](/guides/web/annotations/create-edit-and-remove/cut-copy-duplicate.md)
- [Defining the author of an annotation](/guides/web/annotations/annotation-author-name.md)
- [Detect changes in annotations](/guides/web/annotations/detecting-if-annotations-have-changed.md)
- [Create PDF annotations using JavaScript](/guides/web/annotations/create-edit-and-remove/create.md)
- [Customizing annotation permissions](/guides/web/annotations/create-edit-and-remove/permissions.md)
- [Edit PDF annotations using JavaScript](/guides/web/annotations/create-edit-and-remove/edit.md)
- [Remove PDF annotations using JavaScript](/guides/web/annotations/create-edit-and-remove/remove.md)
- [Rich text in PDF annotations using JavaScript](/guides/web/annotations/create-edit-and-remove/rich-text.md)
- [Undo and redo annotations](/guides/web/annotations/create-edit-and-remove/undo-redo.md)

