# How can we help?

## Overview

Follow these steps to have opt-in checkbox selected by default.

## Select opt-in checkbox by default

1. On top right select **Name** or **Account name** in Web Forms interface.
2. Select **Custom JavaScript**.
3. Paste the following custom JavaScript in the correct places.

This will make the opt-in checkbox selected by default across all lightboxes in the account.

### In before lightbox display

```javascript
//Auto-check opt-in checkbox
var iframe = document.getElementById(“lightbox - iframe - ” +lbid);
if (iframe !== null) {
  var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
  if (iframeDocument) {
    var iframeOptIn = iframeDocument.getElementById(‘form_input_opt_in’);
    if (iframeOptIn) {
      iframeOptIn.checked = PRIMER_CUSTOM_JS_GLOBAL.precheck_checkbox;
    }
  }
}
```

### In after lightbox display

```javascript
//Auto-check opt-in checkbox
var iframe = document.getElementById(“lightbox-iframe-” + lbid);
if (iframe !== null) {
  var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
  if (iframeDocument) {
    var iframeOptIn = iframeDocument.getElementById(‘form_input_opt_in’);
    if (iframeOptIn) {
      iframeOptIn.checked = PRIMER_CUSTOM_JS_GLOBAL.precheck_checkbox;
    }
  }
}
```
