> For the complete documentation index, see [llms.txt](https://jscula.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jscula.gitbook.io/docs/form/.val.md).

# .val()

`.val()` gets or sets the value of a form element.

***

#### Syntax

```js
element.val();
element.val(value);
element.val(callback);
```

***

#### Parameters

* `value` → new value
* `callback` → receives the current value and returns the new value

***

#### Output

Getter:

```js
string
```

Setter:

```js
HTMLElement | NodeList | HTMLCollection
```

***

#### Example

```js
$('#email').val('person@example.com'); //sets new value
```

```js
const email = $('#email').val(); //gets current value
```

***

#### Key Takeaway

> `.val()` is for form values.
