How to change the visibility of specific elements using the display attribute (html/php)
Disclaimer: This is a code segment, not the source in its entirety.
So currently I have a large table enveloping individual tables for a given day (Monday/Tuesday). For each day there's a dropdown box that is supposed to generate large and small text boxes, and that part works (as evidenced in the Tuesday portion).
The part I'm having problems with is trying to change the visibility of anything else, whether it's an h2 Element, a td element or even just the tbody element (I believe the default display values for each of those are "block", "table-row" and "table-row-group" respectively).
The error I've been getting in Chrome's source console is that no matter what type the element is (except for text boxes), it says that its undefined, even though the text boxes have their names and ids displayed in the exact same way.
Please let me know if you understand why this is happening. Note: the particular element that I'm working with at the moment is "mondayWork" in the monday section.
First and Last Name Email Address Date
Monday (Date) Tasks
this is because
this.form['mondayWork'] not refer to element belonging to the form.
mondayWork is belong in tbody tag and it's id attribute. To select this id you have to use document.getElementById
document.getElementById('mondayWork').style.display = 'none'
This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here