WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit f420a33

Browse files
committed
Add documentation for x-html
1 parent 28047ad commit f420a33

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Think of it like [Tailwind](https://tailwindcss.com/) for JavaScript.
1212

1313
**From CDN:** Add the following script to the end of your `<head>` section.
1414
```html
15-
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v1.1.5/dist/alpine.js" defer></script>
15+
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v1.2.0/dist/alpine.js" defer></script>
1616
```
1717

1818
That's it. It will initialize itself.
@@ -92,6 +92,7 @@ There are 10 directives available to you:
9292
| [`x-on`](#x-on) |
9393
| [`x-model`](#x-model) |
9494
| [`x-text`](#x-text) |
95+
| [`x-html`](#x-html) |
9596
| [`x-ref`](#x-ref) |
9697
| [`x-if`](#x-if) |
9798
| [`x-transition`](#x-transition) |
@@ -256,6 +257,15 @@ Adding the `.once` modifer to an event listener will ensure that the listener wi
256257

257258
---
258259

260+
### `x-html`
261+
**Example:** `<span x-html="foo"></span>`
262+
263+
**Structure:** `<span x-html="[expression]"`
264+
265+
`x-html` works similarly to `x-bind`, except instead of updating the value of an attribute, it will update the `innerHTML` of an element.
266+
267+
---
268+
259269
### `x-ref`
260270
**Example:** `<div x-ref="foo"></div><button x-on:click="$refs.foo.innerText = 'bar'"></button>`
261271

0 commit comments

Comments
 (0)