-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattributebind.html
More file actions
59 lines (51 loc) · 1.22 KB
/
attributebind.html
File metadata and controls
59 lines (51 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Alpine JS</title>
<script
defer
src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"
></script>
<style>
.bold {
font-weight: bold;
}
.blueviolet {
color: blueviolet;
}
</style>
</head>
<body>
<div x-data>
<span class="blueviolet" x-bind:class="{'bold': true}"
>Am I blueviolet bold?</span
>
</div>
<hr />
<div
x-data="{
selected: false
}"
>
<span x-bind:class="{'bold': selected}">Is this bold text?</span>
<button @click="selected = true">Make Bold</button>
</div>
<hr />
<form x-data="{name: ''}" @submit.prevent="alert(`Hey! ${name}`)">
<input type="text" x-model="name" />
<button type="submit" x-bind:disabled="name == ''">Let's Go</button>
</form>
<hr />
<div
x-data="{
progress: 0}"
>
<progress max="100" x-bind:value="progress">
<span x-text="`${progress}%`"></span>
</progress>
<button @click="progress += 5">Increse 5%</button>
</div>
</body>
</html>