-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaddWindow.html
39 lines (33 loc) · 953 Bytes
/
addWindow.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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Add Shopping List Item</title>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
</head>
<body>
<div class="container">
<form action="index.html" method="post">
<div>
<label>Enter Item</label>
<input type="text" id="item" autofocus>
</div>
<button class="btn waves-effect waves-light" type="submit">Add Item</button>
</form>
</div>
</body>
<script type="text/javascript">
const electron = require('electron');
const {
ipcRenderer
} = electron;
const form = document.querySelector('form');
form.addEventListener('submit', submitForm);
function submitForm(e) {
e.preventDefault();
const item = document.querySelector('#item').value;
ipcRenderer.send('item:add', item);
}
</script>
</html>