File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 118118
119119 eDiv_dialogContainer.insertBefore(eDiv_ratingWrapper, elm.nextSibling)
120120 }
121+
122+ function changeStar(e, elm) {
123+ const parent = e.target.parentElement
124+ const childrenList = Array.prototype.slice.call(parent.children)
125+ const clickedOn = e.target.getAttribute('data-value')
126+
127+ for(let i=0; i<childrenList.length; i++) {
128+ childrenList[i].classList.remove('active')
129+ if(i < clickedOn) {
130+ childrenList[i].classList.add('active')
131+ }
132+ }
133+
134+ const activeStar = Array.from(parent.children).filter(span => span.classList.contains('active')).length
135+ const questionIndex = Array.from(eDiv_dialogContainer.querySelectorAll('p')).indexOf(elm)
136+ ratings[questionIndex] = activeStar
137+ }
121138</script>
You can’t perform that action at this time.
0 commit comments