Checkbox checked, disabled it
Please, will you help me?
I need disable a checkbox with javascript after it has been selected, I did the next :
I selected a rows from Postgres DB for create the checkbox. I use a Perl languaje in Linux Centos 7, the code is next:
while(my $ref_alarm = $sth->fetchrow_hashref()) {
($gabinete)=$ref_alarm->{'gabinete'};
($alarma)=$ref_alarm->{'descrip_alarma'};
print "<input type='checkbox' name='alarma' id='alarma' value='$alarma' onclick='alarma_reg(this.value);'/>$alarma</input>";
print "<br>";
}
I had been use javascript for disable the checkbox that had been selected:
function alarma_reg(p_alarma) {
//Get the checkbox
document.getElementById("p_alarma").disabled = true;
alarma_operada+=p_alarma + ',';
document.getElementById("ver_alarmas").value=alarma_operada;
}
But the option selected is not disable, please could you help me?
Regards
Xochitl
