-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
36 lines (34 loc) · 1.11 KB
/
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
36
$(document).ready(function() {
pgDemo = new Pg();
pgDemo.setPg("#pages-demo");
srch.setup("#search-demo", callBack);
$(".description>button").click(function() { $(this).parent().css('display', 'none'); })
jsonformDemo();
})
function callBack(res) {
return new Promise(function (resolve, reject) {
setTimeout(function () {
var arr = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"]
.filter(s => s.indexOf(res) >= 0)
.map(s => "<div>" + s + "</div>");
resolve(arr);
}, 50);
});
}
function jsonformDemo() {
var config = {
"First Name: ": {"type": "text",
"placeholder": "my name",
"default": "John",
"id": "myName",
"required": false
},
"Age: ": {"type": "number",
"placeholder": "my age",
"default": "21",
"id": "myAge",
"required": "false"
}};
let form = document.getElementById("jsonform-demo");
form.innerHTML += new JsonForm(config).innerHTML;
}