blob: be2479184463d9f851237b4112418079e9b76a88 (
plain)
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
|
<!doctype html>
<html>
<body>
<input id="input" type="file" />
<input id="input-multiple" multiple type="file" />
<input id="input-disabled" disabled type="file" />
<input id="text-input" type="text" />
<script>
const allEvents = {events: []};
const onEvent = (event) => {
allEvents.events.push({
type: event.type,
files: [...event.target.files].map((file) => file.name),
});
};
const input = document.getElementById('input');
input.addEventListener('input', onEvent);
input.addEventListener('change', onEvent);
input.addEventListener('cancel', onEvent);
const multipleInput = document.getElementById('input-multiple');
multipleInput.addEventListener('input', onEvent);
multipleInput.addEventListener('change', onEvent);
multipleInput.addEventListener('cancel', onEvent);
</script>
</body>
</html>
|