<script type="application/javascript">
window.addEventListener('DOMContentLoaded',function(){
// All Labels in the Radio Button element
const ratingLabel = document.querySelectorAll('.label.postField')
const radioBtns = document.querySelectorAll(".inputWrapper input[type='radio']")
ratingLabel.forEach((rating,index) =>{
rating.innerHTML = `★` // change each label from text to a Star
rating.addEventListener('click',()=>{
updateStarColor(index) // updates color of stars before the one just selected
rating.classList.add('full') // changes color for clicked selection
})
})
function updateStarColor(idx){
ratingLabel.forEach((choice,index)=>{
if(index <= idx){
choice.classList.remove('full')
} else {
choice.classList.add('full')
}
})
}
})//END OF DOMCONTENTLOADED
</script>
<style type="text/css">
.wForm .inputWrapper .choices.horizontal{
display:flex !important;
flex-direction:row-reverse !important;
/* This is required even if placed as horizontal in the Form Builder */
}
.inputWrapper label{
font-size:3rem;
cursor:pointer;
}
/* This hides the radio buttons by default */
.inputWrapper input[type="radio"]{
display:none !important;
}
.inputWrapper input[type="radio"].hide{
display:inline-flex;
}
label.label.postField.full{
color:orange !important;
}
.wFormContainer .htmlSection#tfa_11{
margin:0px;
}
/* As user hovers over the stars, this changes their colors */
.wFormContainer label.label.postField:hover, .wForm span.oneChoice:hover ~ span.oneChoice label.postField {
color:orange !important;
}
</style>