-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
40 lines (26 loc) · 890 Bytes
/
script.js
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
//Script goes here
//ES6-module style
import { TextUpperCaseScript } from "./TextUpperCaseScript.js";
// HTML elements:
const input = document.querySelector('#input');
const addBtn = document.querySelector('#addBtn');
const addedText = document.querySelector('#addedText');
// Variables:
const inputList = [];
//Listener
addBtn.addEventListener(
'click',
function () {
//Imported function:
const inputText = TextUpperCaseScript(input.value);
inputList.push(inputText);
// Add new html elements in ul
const textInput = document.createElement('li');
addedText.appendChild(textInput);
const itemLabel = document.createElement('span');
itemLabel.innerText = inputText;
textInput.appendChild(itemLabel);
input.value = '';
console.log(inputText);
}
);