All browsers are working with the loop except for Internet Explorer, which does not seem to support forEach.
Here is the JavaScript code:
function validate() {
var msg = '';
var i = 0;
arr.forEach(
function validateinfo(){
if (getRBtnName('yesNo_' + i + '_0' == "" && 'yesNo_' + i + '_0') == "") {
msg = 'Please select yes/no for all users'
}
if (msg == '') {
return true;
}
is++;
}
)
if (msg == '') {
reloadpage();
}
if (msg != '') {
alert(msg);
return false;
}
}
function reloadpage(){
window.location.reload()
}
The array is being set in the PHP file rather than passed in. It's being set using:
<script type="text/javascript">
var arr = <?php echo json_encode($arr) ?>;
</script>