---
name: "up.Preview.prototype.disable"
area: "API"
kind: "Instance method"
parent: "up.Preview class"
url: "https://unpoly.com/api/up.Preview.prototype.disable"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.Preview class](https://unpoly.com/api/up.Preview.md)</nav>

# up.Preview.prototype.disable([element])

Temporarily disables fields and buttons.

The disabled controls will be re-enabled when the preview [ends](https://unpoly.com/learn/previews.md#ending).

Also see [Disabling forms while working](https://unpoly.com/learn/disabling-forms.md).

## Example {#example}

This preview disables an `input[name=email]` and all controls within a container matching `.button-bar`:

```js
up.preview('sign-in', function(preview) {
  preview.disable('input[name=email]')
  preview.disable('.button-bar')
})
```

---

## Parameters {#parameters}

### [element=this.fragment] {#element}

(optional)

The element (or selector) within which fields and buttons should be disabled.

If omitted, fields and buttons within the [targeted fragment](https://unpoly.com/api/up.Preview.prototype.fragment.md) will be disabled.

Type: [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) | string

