-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
22 lines (15 loc) · 672 Bytes
/
index.js
File metadata and controls
22 lines (15 loc) · 672 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import tips from './src/tips.js';
document.addEventListener('DOMContentLoaded', () => {
const form = document.querySelector('.feedback-form');
form.addEventListener('submit', function (e) {
e.preventDefault();
const inputs = form.elements;
inputs['subject'].value = decodeURI(inputs['subject'].value);
inputs['body'].value = decodeURI(inputs['body'].value);
form.submit();
});
const tipTemplateHTML = document.querySelector('#tip-template').innerHTML;
const filledTemplateHTML = _.template(tipTemplateHTML);
const tipContainer = document.querySelector('.tip-container');
tipContainer.innerHTML += filledTemplateHTML({ tips });
});