-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodi.js
More file actions
28 lines (22 loc) · 741 Bytes
/
codi.js
File metadata and controls
28 lines (22 loc) · 741 Bytes
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
// Code for creating a modal
var modalBtn = document.querySelector('.modal-btn');
var modalBg = document.querySelector('.modal-bg');
var modalClose = document.querySelector('.modal-close');
modalBtn.addEventListener('click', function() {
modalBg.classList.add('bg-active');
});
modalClose.addEventListener('click', function() {
modalBg.classList.remove('bg-active');
});
// Code for the load file button
const input =
document.querySelector('input[type="file"]');
input.addEventListener('change', function (e) {
const reader = new FileReader()
reader.onload = function () {
text = reader.result
data = JSON.parse(text)
console.log(data)
}
reader.readAsText(input.files[0])
}, false);