-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoding.html
More file actions
78 lines (71 loc) · 4.21 KB
/
coding.html
File metadata and controls
78 lines (71 loc) · 4.21 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
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
<!DOCTYPE html>
<html>
<head>
<title>HTML-QDA</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>HTML-QDA</h2>
<h4>HyperText Markup Language (HTML) Coding for Qualitative Data Analysis (QDA)</h4>
<br />
<div class="row">
<div class="col-md-4">
<form onsubmit="event.preventDefault()">
<div class="form-group">
<label for="search-code">Select Code/Theme:</label>
<select class="form-control" id="search-code">
<option></option>
<option value="code-sad">Sad Moment : code-sad</option>
<option value="code-happy">Happy Moment : code-happy</option>
<option value="theme-moments">Moments : theme-moments</option>
</select>
</div>
<button type="button" class="btn btn-primary" onclick="searchCode()">Search</button>
<button type="reset" class="btn btn-secondary" onclick="resetCode()">Reset</button>
</form>
</div>
</div>
<br />
<div id="content">
<p>This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <span class="code-happy code-sad" title="This is a memo for this happy and sad code.">This sentence contains both happy and sad moments.</span> This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <span class="code-sad" title="This is a memo for this sad code.">This is sentence contains a sad moment.</span> This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. <span class="code-happy" title="This is a memo for this happy code.">This is sentence contains a happy moment.</span> This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.</p>
</div>
</div>
<script>
// Codes
const happy = document.querySelectorAll('.code-happy');
const sad = document.querySelectorAll('.code-sad');
// Themes
happy.forEach(code => code.classList.add('theme-moments'));
sad.forEach(code => code.classList.add('theme-moments'));
// Reset
function resetCode() {
happy.forEach(function(code) {
code.style.color = 'black';
code.style.fontWeight = 'normal';
});
sad.forEach(function(code) {
code.style.color = 'black';
code.style.fontWeight = 'normal';
});
}
// Search code
function searchCode() {
resetCode(); // Reset
let codeValue = document.querySelector('#search-code').value.toLowerCase();
let codeArr = document.querySelectorAll('.' + codeValue);
codeArr.forEach(function(code) {
code.style.color = 'red';
code.style.fontWeight = 'bold';
});
// codeArr.forEach(code => code.style.color = 'red');
// codeArr.forEach(code => code.style.fontWeight = 'bold');
}
</script>
</body>
</html>