I have a function in JavaScript that validates data. The problem is that it uses alerts
to warn when data is badly loaded. What I want to do is show Bootstrap modal windows to see the error.
This is what I did, which does not work:
var contador = <?=($_GET['sensores'])? count($_GET['sensores']):'0'?>;
window.validar = function (cual){
if(cual.value == -1){
}
if($("#muestragrafico1").is(':checked')){
var cantidad = 3;
}else{
var cantidad = 1;
}
if(cual.checked){
contador++;
}else{
contador--;
}
if(contador <= cantidad){
return true;
}else{
if (cantidad == 3) {
//alert("Solo puede seleccionar un máximo de "+cantidad+" sensores.");
$('#myModalExito').modal('show');
}
if (cantidad == 1) {
alert("Solo puede seleccionar un máximo de "+cantidad+" sensores.");
}
contador--;
return false;
}
}