How to hide a label for a textbox?

R

RudiH

I have created a textbox and associated a label to it on a form. This label
and the textbox should only be visible when a certain checkbox is checked. I
was able to to hide the textbox successfully. But how do you hide the
associated label as well?
Can somebody help?
 
M

MD Websunlimited

Hi Rudi,

Set the innerTEXT to an empty string, e.g.

<label for="myElement" >My Element</label>

obj = getElementById(id);
obj.innerText = '';
 
R

RudiH

Hi Mike,
I wrote the function below, but it doesn't work as expected:
function EnableDisable (chkbx)
{

if (chkbx.checked == true)
{
document.ApplicationForm.txtFrom.style.visibility= "visible";
document.ApplicationForm.txtTo.style.visibility= "visible";
}
else
{
document.ApplicationForm.txtFrom.style.visibility= "hidden";
obj = document.getElementById("fp2");
obj.innerText = '';
document.ApplicationForm.txtTo.style.visibility= "hidden";
obj = document.getElementById("fp3");
obj.innerText = '';
}
}
Do you know what's wrong?
Regards
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top