-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
54 lines (51 loc) · 1.44 KB
/
index.html
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
<html>
<head>
<title>Demo</title>
<script src="dist/dirty-form.js"></script>
<script>
document.addEventListener("DOMContentLoaded", () => {
const form = document.getElementById("form");
const dirtyForm = new DirtyForm(form, {
onDirty: () => {
form.querySelector("input[type=submit]").removeAttribute("disabled");
}
});
form.addEventListener("submit", () => {
dirtyForm.disconnect();
});
});
</script>
<!-- Trix -->
<link rel="stylesheet" type="text/css" href="https://unpkg.com/[email protected]/dist/trix.css">
<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/trix.umd.min.js"></script>
</head>
<body>
<h1>First page</h1>
<p>
<a href="second.html">Go to second page</a>
</p>
<div>
<form action="second.html" method="post" id="form">
<p>
<input type="text" name="name">
</p>
<p>
<select name="enabled">
<option value="true">True</option>
<option value="false">False</option>
</select>
</p>
<p>
<textarea name="message"></textarea>
</p>
<p>
<input id="x" type="hidden" name="content">
<trix-editor input="x"></trix-editor>
</p>
<p>
<input type="submit" value="Submit" disabled>
</p>
</form>
</div>
</body>
</html>