I'm using the following code to check if a radio is selected, if it is, perform such a function:
<script language="javascript">
document.onclick = function setFries() {
var apc = document.getElementById("10000_3").checked;
var ape = document.getElementById("10000_5").checked;
if (apc) {
window.alert("teste 1");
}
}
</script>
But if I add more than 2 variables the script just does not work.
In total I will use 24 variables, so I did the following:
<script language="javascript">
document.onclick = function setFries() {
var apc = document.getElementById("10000_3").checked;
var ape = document.getElementById("10000_5").checked;
var aac = document.getElementById("10000_6").checked;
var aae = document.getElementById("10000_7").checked;
var cpc = document.getElementById("10000_8").checked;
var cpe = document.getElementById("10000_9").checked;
var cac = document.getElementById("10000_10").checked;
var cae = document.getElementById("10000_11").checked;
var dpc = document.getElementById("10000_12").checked;
var dpe = document.getElementById("10000_13").checked;
var dac = document.getElementById("10000_14").checked;
var dae = document.getElementById("10000_15").checked;
var hpc = document.getElementById("10000_16").checked;
var hpe = document.getElementById("10000_17").checked;
var hac = document.getElementById("10000_18").checked;
var hae = document.getElementById("10000_19").checked;
var lpc = document.getElementById("10000_20").checked;
var lpe = document.getElementById("10000_21").checked;
var lac = document.getElementById("10000_22").checked;
var lae = document.getElementById("10000_23").checked;
var ppc = document.getElementById("10000_24").checked;
var ppe = document.getElementById("10000_25").checked;
var pac = document.getElementById("10000_26").checked;
var pae = document.getElementById("10000_27").checked;
if (apc) {
window.alert("teste 2");
}
}
</script>
But it did not work, I was excluding 1 in 1 variable, and only worked when I was 2.
Please, where is the error?