Support MB Frontend Submission How to maintain a counter/score based on values in radio boxes? Reply To: How to maintain a counter/score based on values in radio boxes?

#10422
EddyPiVEddyPiV
Participant

For my understanding, what this js is doing is counting the number of checked items with class=like, and displaying the counter, right?

I was wondering, can I also include this in the page from where I launch the Frontend Submission?
Because then I can control the location where I want the counter to be displayed.

It would then look like:

<script>
var total = 0;
$( '.like input:checked' ).each( function() {
    total += $(this).val();
} );
// Output total somewhere
$( '#selector' ).text( total );
</script>

By the way, I created the .js file, stored it in the js folder of my theme, and included the call in the functions.php, but it doesn't show a counter, and I don't know if it counts...