We help IT Professionals succeed at work.

Hide text and checkbox using Javascript

6,089 Views
Last Modified: 2013-11-19
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>
      
Comment
Watch Question

Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
b0lsc0ttIT Manager
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Jason MintonEpic ODBA

Commented:
In your style sheet, just set either the display to none or the visibility to hidden for those classes.

display: none;

or

visibility: hidden;
b0lsc0ttIT Manager
CERTIFIED EXPERT

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

bol
b0lsc0ttIT Manager
CERTIFIED EXPERT

Commented:
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

Author

Commented:
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.

Jason MintonEpic ODBA

Commented:
put <div> tags around this section like this:

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

</div>
b0lsc0ttIT Manager
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
b0lsc0ttIT Manager
CERTIFIED EXPERT

Commented:
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
Jason MintonEpic ODBA
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
b0lsc0ttIT Manager
CERTIFIED EXPERT

Commented:
Thanks for the grade, the points and the fun question.  I'm glad I could help.

bol

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.