Link to home
Start Free TrialLog in
Avatar of lbeham
lbeham

asked on

Hide text and checkbox using Javascript

I would like to hide this  whole section  - check box and text on the page.  This code is part of a content management system so I can't just remove or comment out the code.  I have to use Javascript to hide it.

</TR>
                  
                  
                  <tr id="PC684_trAnonymous">
            <td class="BBFieldCaption DonationFieldCaption">Anonymous:</td>
            <TD colspan="2">
                              <span class="BBFieldCheckboxCaption DonationFieldCheckboxCaption"><input id="PC684_chkAnonymous" type="checkbox" name="PC684:chkAnonymous" /><label for="PC684_chkAnonymous">I prefer to make this donation anonymously</label></span></TD>
      </tr>
      
ASKER CERTIFIED SOLUTION
Avatar of ncoo
ncoo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of b0lsc0tt
b0lsc0tt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In your style sheet, just set either the display to none or the visibility to hidden for those classes.

display: none;

or

visibility: hidden;
Good catch Walkerke.  For some reason I mix those up occasionally, even when I double check.  :)

bol
I recommend you use display: none and not use visibility.  Visibility can have mixed support in browsers and would effect the layout of the page, which I don't think you want in this case.

bol
Avatar of lbeham
lbeham

ASKER

I tried both scripts and neither one removed the text or check box.  It is a content management system. I am adding the script to the html portion of  a formatted text and image part.  I've tried putting it a the top, then at the bottom of the page.  It is currently still displaying.

put <div> tags around this section like this:

<div style="display:none;">
   
   stuff to hid here

</div>
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you do use Jasonsbytes' suggestion of the div tags then I would recommend not including the tr and td tags.  Put that information, which is hidden anyways, outside of the table, if possible.

bol
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the grade, the points and the fun question.  I'm glad I could help.

bol