Javascript - very simple checkbox onclick code not working - any help please?

Hello folks,

I have a content form. It has a textbox and a checkbox control (both are asp server controls and not HTML).

When the user checks on the checkbox control, the textbox control has to become invisible. If unchecked the textbox control has to become visible. The following code works on a regular webform (meaning not as a content form). toggleVisibility is the function name that does the actual work. I am guessing I am not passing the textbox control ID properly to toggleVisibility function. Can someone guide me please?

Following is the code:

<asp:TextBox ID="TextBoxPeriod"
        runat="server"  Width="97px"></asp:TextBox>

<asp:CheckBox ID="CheckBoxFromArchive"  runat="server" Visible="true"
           Onclick="toggleVisibility('<%=TextBoxPeriod.ClientID %>');"  />

 function toggleVisibility(controlId) {
        var control = document.getElementById(controlId);

        if ( == "visible" || == "") {
   = "hidden";


        else {
   = "visible";



Thanks much

I think that seen the resultant code that goes to the browser, not the sever code, will be a easier way to find out what’s is not working in so simply task.

See you :cool: