-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
40 lines (36 loc) · 1.14 KB
/
Copy pathscript.js
File metadata and controls
40 lines (36 loc) · 1.14 KB
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
40
var btn = document.getElementById("button");
var see_button = document.getElementById("see-button");
var inputField = document.getElementById("user-input");
var blank = "";
var showPara;
function func() {
var getText = inputField.value;
if (getText !== "") {
blank = getText;
if(blank.length > 50){
see_button.style.display = 'inline';
}
else{
see_button.style.display = 'none';
}
var copiedText = blank.slice(0, 50);
if (blank.length > 50) {
showPara = document.createElement('p');
showPara.innerText = copiedText;
document.body.appendChild(showPara);
} else {
showPara = document.createElement('p');
showPara.innerText = blank;
document.body.appendChild(showPara);
}
}
}
function seeText() {
if (see_button.innerText === "See more") {
showPara.innerText = blank;
see_button.innerText = "See less";
} else {
showPara.innerText = blank.slice(0, 50);
see_button.innerText = "See more";
}
}