File size: 613 Bytes
7da13d6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
x-text
======

`x-text` sets the text content of an element to the result of a given expression.

Here's a basic example of using `x-text` to display a user's username.

    <div x-data="{ username: 'calebporzio' }">    Username: <strong x-text="username"></strong></div>
    <div x-data="{ username: 'calebporzio' }">
        Username: <strong x-text="username"></strong>
    </div>

Username: **calebporzio**

Now the `<strong>` tag's inner text content will be set to "calebporzio".

[← x-on](/directives/on)

[x-html β†’](/directives/html)

Code highlighting provided by [Torchlight](https://torchlight.dev)