<input type="checkbox" id="alert1" value="111">
<input type="checkbox" id="alert2" value="222">
<input type="checkbox" id="alert3" value="333">
<input type="button" onclick="checkBox()" value="check">
function checkBox(){
var alert1 = document.getElementById('alert1').checked;
var alert2 = document.getElementById('alert2').checked;
var alert3 = document.getElementById('alert3').checked;
if(alert1 == 1 && alert2 == 2 && alert3 == 1){
do somthing...
}
if(alert1 == 1 || alert2 == 2 || alert3 == 1){
do somthing...
}
}
What should i do if i like only one of this condition to be “true”.
This syntax show both of the conditions as “true”.
I had hard times to understand what you need. Hope this is what you are after