---
title: "web update · RUAL Documentation"
description: "Gives one element of the page new contents, keeping the element itself: a counter, a total, a message. A RUAL web block in the web actions group."
canonical: https://docs.rual.nl/block-types/web/web_update
language: en
---

# web update

This block is part of the [`web`](https://docs.rual.nl/block-types/web) group and was last modified in core [`v15.0.1`](https://docs.rual.nl/core-versions/150001).

Gives one element of the page new contents, keeping the element itself: a counter, a total, a message.

- flow

- key `value` The element's data-key: a row of web for each, or the key a web action received.

- target `value` A CSS selector instead of a key, e.g. `#cart-count`.

- html `value` required

- flow

Adds a browser update to the web action's answer: the element's contents become `html` (innerHTML; the element and its attributes stay). For a plain value pass text: it is HTML, so escape user input with a web template first. Addressed by `key` (matches [data-key="<key>"]) or, when key is empty, `target` (a CSS selector); neither is an error that stops the flow. Only in a flow started by web_action (an error elsewhere). Updates apply in the order the blocks ran.

| `set html` |
| --- |
| `update counter` |
| `inner html` |

A like button: [increment by field](https://docs.rual.nl/block-types/mutations/mutations_increment_by_field) and [update document](https://docs.rual.nl/block-types/storage/function_update_document_mutations) count the like on the document the key names, and [get fields](https://docs.rual.nl/block-types/object/object_field_getter_multiple) reads the new number back. [web update](https://docs.rual.nl/block-types/web/web_update) gives the element the target pin selects new contents and keeps the element and its attributes. Its html pin takes HTML, also when you meant plain text: a number from a stored document is fine through [cast to value](https://docs.rual.nl/block-types/type%20casting/number_convert_to_value), but text a visitor typed goes through [web template](https://docs.rual.nl/block-types/web/web_template) first, so it gets escaped.

[![Studio canvas example for the web update block: a counter that keeps its element.](https://docs.rual.nl/canvas-examples/web_update.png)](https://docs.rual.nl/canvas-examples/web_update.png?v=3)

## Used in these guides

These documentation pages use or explain this block:

- [Building a Dashboard with Charts](https://docs.rual.nl/tutorials/dashboard-charts)

- [Building a Login Page](https://docs.rual.nl/tutorials/login-page)

- [File Upload & Processing](https://docs.rual.nl/tutorials/file-upload-processing)

- [Escaping and Security](https://docs.rual.nl/web/security)

- [Lists and Tables](https://docs.rual.nl/web/lists)

- [Migrating from State Pages](https://docs.rual.nl/web/migrate-from-state-pages)

- [Tutorial: A Small Webshop](https://docs.rual.nl/web/build-a-shop)

- [Web Actions](https://docs.rual.nl/web/actions)

## Version history

Introduced in [`v15.0.1`](https://docs.rual.nl/core-versions/150001).

- [`v15.0.1`](https://docs.rual.nl/core-versions/150001): block added in this release.

- [Back to `web`](https://docs.rual.nl/block-types/web): Return to the main group to view all sub-groups

- [Back to `web actions`](https://docs.rual.nl/block-types/web?group=web%20actions): Return to the group to view all blocks within this group
