<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@friendlycaptcha/sdk](./sdk.md) &gt; [FriendlyCaptchaSDK](./sdk.friendlycaptchasdk.md) &gt; [attach](./sdk.friendlycaptchasdk.attach.md)

## FriendlyCaptchaSDK.attach() method

Attaches a widget to given element or elements if they are not attached to yet.

You can pass one or more HTML elements to attach to, or undefined. If `undefined` is passed, the HTML page is scanned for unattached widget elements (= elements with the `frc-captcha` class).

Returns handles to the newly-attached elements.

**Signature:**

```typescript
attach(elements?: HTMLElement | HTMLElement[] | NodeListOf<Element>): WidgetHandle[];
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

elements


</td><td>

HTMLElement \| HTMLElement\[\] \| NodeListOf&lt;Element&gt;


</td><td>

_(Optional)_


</td></tr>
</tbody></table>

**Returns:**

[WidgetHandle](./sdk.widgethandle.md)<!-- -->\[\]

