You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
docuseal/app/javascript/elements/review_form.js

20 lines
627 B

export default class extends HTMLElement {
connectedCallback () {
this.querySelectorAll('input[type="radio"]').forEach(radio => {
radio.addEventListener('change', (event) => {
const rating = parseInt(event.target.value)
if (rating === 10) {
window.review_comment.value = ''
window.review_comment.classList.add('hidden')
window.review_submit.classList.add('hidden')
event.target.form.submit()
} else {
window.review_comment.classList.remove('hidden')
window.review_submit.classList.remove('hidden')
}
})
})
}
}