---
title: Virtual binder
project: jComponent V19
version: 19.194
section: reference
language: en
license: MIT
url: https://totaljs.es/docs/jcomponent-v19/19-194/reference/vbinder/
updated: 2026-11-18T13:58:29.465Z
---

# Virtual binder

> The properties and methods of the objects created by VBIND() and VBINDARRAY().

A virtual binder renders an HTML fragment from its own model, without using the global data model. `VBIND()` creates one binder, and `VBINDARRAY()` creates a list with one binder per item. Paths inside the fragment start with a dot. [Virtual bindings](../../guides/virtual-bindings/) explains the concept.

## API

### binder.element

Type: `property`

The rendered fragment as a jQuery object.

Add it to the page yourself.

Example: Inserting the fragment
```js
binder.element.appendTo('body');
console.log(binder.element.attr('class'));  // row
```

### binder.binders

Type: `property`

The binders found in the fragment.

See the [`refresh()`](../ui-bind/#refresh) and [`exec()`](../ui-bind/#exec) methods.

Example: Counting binders
```js
console.log(binder.binders.length);  // 1
```

### binder.value

Type: `property`

The current model.

Example: Reading the model
```js
binder.set({ name: 'Peter' });
console.log(binder.value.name);  // Peter
```

### binder.set([path], value, [skipchecksum])

Type: `method`

Replaces the model or changes a field of it.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | no |  | The path inside the model. |
| `value` | `Object` | yes |  | The model or the value of the field. |
| `skipchecksum` | `Boolean` | no |  | `true` skips the checksum of an item in `VBINDARRAY()`. |

Returns: `VBinder` The binder.

With one argument, the value becomes the whole model. With a path, the model must already exist and the value must not be `null`.

Example: Using set()
```js
binder.set({ name: 'Peter' });
binder.set('name', 'Anna');
console.log(binder.element.text());  // Anna
```

### binder.get([path])

Type: `method`

Reads the model or a field of it.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | no |  | The path inside the model. |

Returns: `Object` The value.

Example: Using get()
```js
binder.set({ name: 'Peter' });
console.log(binder.get('name'));  // Peter
console.log(binder.get());  // {"name":"Peter"}
```

### binder.upd([path], [skipchecksum])

Type: `method`

Renders the fragment again.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `path` | `String` | no |  | The path inside the model. |
| `skipchecksum` | `Boolean` | no |  | `true` skips the checksum of an item in `VBINDARRAY()`. |

Returns: `VBinder` The binder.

With a path, only the binders of that path run.

Example: Using upd()
```js
binder.set({ name: 'Peter' });
binder.value.name = 'Anna';
binder.upd('name');
console.log(binder.element.text());  // Anna
```

### binder.on(name, [selector], callback)

Type: `method`

Attaches a jQuery event to the fragment.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | The name of the event. |
| `selector` | `String` | no |  | The delegated selector. |
| `callback` | `Function` | yes |  | The handler. |

Returns: `VBinder` The binder.

The arguments are the same as in the jQuery `on()` method.

Example: Using on()
```js
binder.on('click', 'ui-bind', () => console.log('clicked'));  // clicked
binder.element.find('ui-bind').click();
```

### binder.remove()

Type: `method`

Removes the fragment and releases the binder.

Returns: `Object` Always `null`.

Example: Using remove()
```js
binder.remove();
console.log($('.row').length, binder.element);  // 0 null
```

### list.items

Type: `property`

The binders of a `VBINDARRAY()` list.

Each item is a virtual binder with the additional properties `index` and `vbindarray`.

Example: Reading the items
```js
items.set([{ name: 'Peter' }, { name: 'Anna' }]);
console.log(items.items.length, items.items[1].index);  // 2 1
```

### list.set(array) or list.set(index, value)

Type: `method`

Renders an array or changes one item.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `array` | `Array|Number` | yes |  | The array, or the index of the item. |
| `value` | `Object` | no |  | The new item. |

An array renders the list. An index replaces the item at that position. `null` removes all rendered items.

Example: Using list.set()
```js
items.set([{ name: 'Peter' }, { name: 'Anna' }]);
items.set(1, { name: 'Lucia' });
console.log($('#list').text());  // PeterLucia
```

### list.get([index])

Type: `method`

Reads the array or one item.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `index` | `Number` | no |  | The index of the item. |

Returns: `Object|Array` The value.

Example: Using list.get()
```js
items.set([{ name: 'Peter' }]);
console.log(items.get(0).name, items.get().length);  // Peter 1
```

### list.upd([index])

Type: `method`

Renders the list or one item again.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `index` | `Number` | no |  | The index of the item. |

Returns: `Object` The list.

Example: Using list.upd()
```js
items.set([{ name: 'Peter' }]);
items.get(0).name = 'Anna';
items.upd(0);
console.log($('#list').text());  // Anna
```

### list.remove()

Type: `method`

Removes all items and releases the list.

Example: Using list.remove()
```js
items.set([{ name: 'Peter' }]);
items.remove();
console.log($('#list').html() === '');  // true
```
