I need assistance in storing checkbox API values. I have multiple checkboxes and I can display API values in html when checkbox is checked. But how do I store the initial value of a checked checkbox and show it in a span?
I currently get “on” value instead of API initial value instead of "on" value.
eg. The value I want is “Breakfast Event” as stored in the API
Below is my code:
<input type="checkbox" id="myCheck1" name="checks" class="round">
<span id="eventTitle" class="results"></span>
//store checkbox values
$('#myCheck1').on('change', function() {
$('.results').html(this.checked ? this.value : '');
});