-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
38 lines (33 loc) · 1.3 KB
/
app.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
36
37
38
const buttonadd = document.querySelector("main button");
const buttoncopy = document.querySelector(".btnincorner");
const list = document.querySelector("article")
var sectionid = 1;
//var num = 0;
//events
buttonadd.addEventListener("click", add);
buttoncopy.addEventListener("click", create)
function add(){
sectionid++;
const section = document.createElement("section");
const input = document.createElement("input");
const textarea = document.createElement("textarea");
section.setAttribute("id", sectionid);
input.setAttribute("placeholder", " Question");
textarea.setAttribute("placeholder", " correct answer");
document.querySelector("article").appendChild(section);
document.getElementById(sectionid).appendChild(input);
document.getElementById(sectionid).appendChild(textarea);
}
function create(e){
let url = new URLSearchParams();
const quizlist = list.childNodes;
const ele = e.target.parentElement;
quizlist.forEach(function(ele){
//num++;
//var ask = "ask" + num;
//var replay = "replay" + num;
url.append("ask",ele.firstChild.value);
url.append("replay",ele.lastChild.value);
})
navigator.clipboard.writeText(window.location.origin + "/QUIZ-MAKER-BASED-ON-URL-READING" + "/quiz.html" + "?" + url);
}