Skip to content

Commit

Permalink
Add documentation for x-html
Browse files Browse the repository at this point in the history
  • Loading branch information
calebporzio committed Jan 4, 2020
1 parent 28047ad commit f420a33
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Think of it like [Tailwind](https://tailwindcss.com/) for JavaScript.

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

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

---

### `x-html`
**Example:** `<span x-html="foo"></span>`

**Structure:** `<span x-html="[expression]"`

`x-html` works similarly to `x-bind`, except instead of updating the value of an attribute, it will update the `innerHTML` of an element.

---

### `x-ref`
**Example:** `<div x-ref="foo"></div><button x-on:click="$refs.foo.innerText = 'bar'"></button>`

Expand Down

0 comments on commit f420a33

Please sign in to comment.