I'm doing a js that responds to when I click on a checkbox:
function actionCheckbox(){
var chkAp = document.getElementById("ahorroAP");
var chkCa2 = document.getElementById("ahorroCa2");
var chkAhorro = document.getElementById("ahorroDep");
if(chkApv.value){
agregarAp();
}else if(chkCta2.value){
agregarPlanCa2();
}else if(chkAhorroDeposito.value){
agregarAhorroDep();
}else{
cleanfields();
}
}
The problem is that when I click on the second chkbox savingCa2, only the first if
is executed.
Goal
My goal is to make a listener that gets the click event of any of those 3 checkboxes so that the corresponding% if
is executed.