-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.js
More file actions
43 lines (31 loc) · 1.04 KB
/
Copy pathindex.js
File metadata and controls
43 lines (31 loc) · 1.04 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
41
42
$(document).ready(function() {
$('select').niceSelect();
});
let searchTerm = ''
function watchForm() {
$("#js-select-language").change(e => {
e.preventDefault();
$('#js-screen-for-select-language').hide()
$('#js-screen-for-search-term').show()
$("#form-input").submit(e => {
e.preventDefault();
searchTerm = document.querySelector("#search-input").value;
getResults(searchTerm);
})
});
}
function getResults(searchTerm) {
if(searchTerm == "I want to add two numbers") {
document.querySelector("#js-section-results").innerHTML = "addNumbers"
}
if(searchTerm == "I want to draw a circle") {
document.querySelector("#js-section-results").innerHTML = "drawCircle"
}
if(searchTerm == "List all my favourite books") {
document.querySelector("#js-section-results").innerHTML = "favBookList"
}
if(searchTerm == "List all my grades for year 2018-2019") {
document.querySelector("#js-section-results").innerHTML = "grades2018-2018"
}
}
watchForm();