-
Notifications
You must be signed in to change notification settings - Fork 2
/
subjectpicker.js
78 lines (69 loc) · 1.7 KB
/
subjectpicker.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright © 2014 Max Penrose
$(document).ready(function(){
var availableSubjects = [
"Maths",
"English Literature",
"English Language",
"Geography",
"History",
"Biology",
"Physics",
"Chemistry",
"Religious Studies",
"French",
"Music",
"German",
"Spanish",
"Latin",
"Greek",
"Art",
];
$( ".subjectPick" ).autocomplete({
source: availableSubjects
});
});
function newSubject(){
var selectionCount = document.querySelectorAll("#subjectPicker > div").length + 1;
var sub = document.createElement('div');
sub.className = 'subjectPickerSubject';
var input = document.createElement('input');
input.placeholder = 'Subject';
input.className = 'subjectPick';
input.name = 's' + selectionCount;
sub.appendChild(input);
var select = document.createElement('select');
select.name = 'b' + selectionCount;
var optionAQA = document.createElement('option');
optionAQA.value = 'aqa'
var nodeAQA = document.createTextNode('AQA');
optionAQA.appendChild(nodeAQA);
select.appendChild(optionAQA);
var optionAQA = document.createElement('option');
optionAQA.value = 'other'
var nodeAQA = document.createTextNode('Other');
optionAQA.appendChild(nodeAQA);
select.appendChild(optionAQA);
sub.appendChild(select);
document.getElementById('subPickarea').appendChild(sub);
var availableSubjects = [
"Maths",
"English Literature",
"English Language",
"Geography",
"History",
"Biology",
"Physics",
"Chemistry",
"Religious Studies",
"French",
"Music",
"German",
"Spanish",
"Latin",
"Greek",
"Art",
];
$( ".subjectPick" ).autocomplete({
source: availableSubjects
});
}