I would like to know how to enable or disable a select box when I click on a
checkbox!?
I tried several ways but none does what I want!
Here is my code:
/**********************************/
function setPrimaryCategory(checkb) {
f = document.getElementById("c_form");
if (checkb.checked) {
f.c_primcat.enabled = false;
}
else {
doSomething()
}
}
/**********************************/
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Olivier
"phpounch" wrote in news:40d6b34c$0$23518$:
Hello,
I would like to know how to enable or disable a select box when I click on a checkbox!? I tried several ways but none does what I want!
Here is my code: /**********************************/ function setPrimaryCategory(checkb) { f = document.getElementById("c_form"); if (checkb.checked) { f.c_primcat.enabled = false; } else { doSomething() } } /**********************************/
What do you think? Thanks, Dams
Hello,
Huh, you're on a french newsgroup ^^ But I'll answer your question : The property which allows to enable/disable an <input> or <select> element is "disabled", not "enabled". So, instead of writing that : f.c_primcat.enabled = false; you should write that : f.c_primcat.disabled = true;
Bye O.L.
"phpounch" <mooborufx@free.fr> wrote in
news:40d6b34c$0$23518$626a14ce@news.free.fr:
Hello,
I would like to know how to enable or disable a select box when I
click on a checkbox!?
I tried several ways but none does what I want!
Here is my code:
/**********************************/
function setPrimaryCategory(checkb) {
f = document.getElementById("c_form");
if (checkb.checked) {
f.c_primcat.enabled = false;
}
else {
doSomething()
}
}
/**********************************/
What do you think?
Thanks,
Dams
Hello,
Huh, you're on a french newsgroup ^^
But I'll answer your question :
The property which allows to enable/disable an <input> or <select>
element is "disabled", not "enabled".
So, instead of writing that :
f.c_primcat.enabled = false;
you should write that :
f.c_primcat.disabled = true;
I would like to know how to enable or disable a select box when I click on a checkbox!? I tried several ways but none does what I want!
Here is my code: /**********************************/ function setPrimaryCategory(checkb) { f = document.getElementById("c_form"); if (checkb.checked) { f.c_primcat.enabled = false; } else { doSomething() } } /**********************************/
What do you think? Thanks, Dams
Hello,
Huh, you're on a french newsgroup ^^ But I'll answer your question : The property which allows to enable/disable an <input> or <select> element is "disabled", not "enabled". So, instead of writing that : f.c_primcat.enabled = false; you should write that : f.c_primcat.disabled = true;