Skip to content

Commit a46c231

Browse files
committed
Adds options w code
1 parent fb49f28 commit a46c231

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

_pages/wc.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ description: Word cloud visualization of blog posts by year.
2929
<label for="yearSelect">Select a year:</label>
3030
<select id="yearSelect">
3131
<option value="">-- Choose Year --</option>
32-
<option value="2024">2024</option>
33-
<option value="2023">2023</option>
34-
<option value="2022">2022</option>
35-
<option value="2021">2021</option>
36-
<option value="2006">2006</option>
3732
</select>
3833
</div>
3934

@@ -43,6 +38,15 @@ description: Word cloud visualization of blog posts by year.
4338
const canvas = document.getElementById('wordcloud');
4439
const yearSelect = document.getElementById('yearSelect');
4540

41+
document.addEventListener("DOMContentLoaded", () => {
42+
const yearSelector = document.getElementById("yearSelect");
43+
44+
const endYear = new Date().getFullYear();
45+
for(let year = 2006; year <= endYear; year++) {
46+
studentSelect.append(new Option(""+year, ""+year, true, true));
47+
}
48+
});
49+
4650
yearSelect.addEventListener('change', () => {
4751
const year = yearSelect.value;
4852
if (!year) return;

0 commit comments

Comments
 (0)