Hi im trying to create a simple script in javascript that disables and enables a text field when u press a certain checkbox.
Problem is that the checkboxes are build with php and cant be given an ID.
So ive tried to do it with grabbing the element and that works.
Now i want to make it easier for me to adjust so i dont have to make 6000 different script for different checkboxes.
it should work with document.formnaam.radionaam[nummer].checked
but im getting undefined when i check it. seems it doesnt pick the names up because of the dots… Im not sure how to write it to make it work…
Thanks.
function textfieldCheck(naam, radionaam, nummer) {
//alert(document.formnaam.radionaam[nummer].value);
var radiopath = naam + . + radionaam + [ + nummer + ] + .checked
alert(radiopath);
if (radiopath == 1) {
alert('tog wel')
}
//alert(radiopath);
//var textfield = radiopath + "_text"
/*if (document.naam.radionaam[nummer].checked == 1) {
document.naam.textveld.disabled = false;
} else {
document.naam.textveld.disabled = true;
}*/
}