By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,301 Members | 1,741 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,301 IT Pros & Developers. It's quick & easy.

JavaScript - Show/Hide table rows with unchecked checkboxes

P: 1
Hi -
I have a table with about 30 rows, which contain a checkbox and a bit of text each. What I'm trying to find a way to do is to have 2 buttons at the bottom of the page - HIDE & SHOW. When the HIDE button is clicked, I need to hide all the table rows which contain UNCHECKED textboxes. When the SHOW button is clicked, I want to restore the visibility of all the rows. I need to do this in JavaScript (which is what I'm having trouble with) - I've been able to get bits of it to work at various times, but I'm running out of time and I really need help. Any suggestions anyone has would be more than appreciated!
Thanks!
j-
May 3 '06 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
To find rows with unchecked checkboxes, check the "checked" property. If it's false, the checkbox is unchecked. To determine the row, you could use parentNode to refer to the cell and then the row and set it's style.display property to "none" to hide it.

To show a row, IE says "block", but the proper setting should be "table-row". Setting it to "" usually works.
Apr 24 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.