I have a checkbox set to checked:
<input type="checkbox" value="24hrs" name="timeformat[]" id="isCheckedFormat" checked>
<select class="form-control" name="Mon1" id="mon1"></select>
I try to do a JQuery so that if it's checked it uses an array with certain values and if it's not checked than with different array values.
if ($('#isCheckedFormat').is(':checked')true){
var vals = [1,2,3,4,5];
}else{
var vals = ['a','b','c','d','e'];
}
These then populate select fields:
for(var i = 0; i<vals.length; i++) {
$('#mon1').append('<option val="'+vals[i]+'">'+vals[i]+'</option>');
}
At the moment the 'select option' doesn't get populated by either values from the array vals
selectis in the html code