Skip to content

Commit d41f64d

Browse files
committed
javascript HTMLElement collection confusing
1 parent 7713bb5 commit d41f64d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

frontend/javascript/modules/majorProjectForm.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ export default class MajorProjectForm {
5252

5353
let skills = [];
5454

55-
for (const skill in document.getElementsByClassName('span[class=skill-tag]')) {
56-
skills.push(skill.innerText)
57-
}
55+
Array.from(document.getElementsByClassName('skill-tag')).forEach(tag => skills.push(tag.firstChild.data))
5856

5957
let payload = {
6058
projectName: this.form.querySelector('input[name=name]').value,
@@ -63,7 +61,7 @@ export default class MajorProjectForm {
6361
projectSkills: skills,
6462
projectDescription: this.form.querySelector('textarea[name=description]').value
6563
};
66-
64+
6765
console.log(payload)
6866

6967
FetchUtil.postWithWarning(this.endpoint, payload, {

0 commit comments

Comments
 (0)