Show Hide Question

M

Mel

i Have a table with two columns and a checkbox above it.
when the box is checked, i like to show the two <TD>s

i have:

<TD ID=1000 style=display=none>APPLE</TD>
<TD ID=1000 style=display=none>ORANGE</TD>

how can i do this with JS ?

i have used getElementById, but it only return one of the ids '1000'

thanks
 
I

Ian Collins

Mel said:
i Have a table with two columns and a checkbox above it.
when the box is checked, i like to show the two <TD>s

i have:

<TD ID=1000 style=display=none>APPLE</TD>
<TD ID=1000 style=display=none>ORANGE</TD>
This is invalid markup, id must be unique.

Use CSS classes, one for hidden and one for visible.
 
D

David Dorward

Mel said:
i Have a table with two columns and a checkbox above it.
when the box is checked, i like to show the two <TD>s

i have:

<TD ID=1000 style=display=none>APPLE</TD>
<TD ID=1000 style=display=none>ORANGE</TD>

This is very wrong. An id is a unique (per document) identifier, you can't
have two elements in the same document with the same id. Additionally, an
id cannot begin with a number.

Attribute values containing "=" characters must be quoted, and CSS uses
a ":" to assign a value to a property, not an "=".
how can i do this with JS ?

i have used getElementById, but it only return one of the ids '1000'

Use something else to identify the elements. There are a number of
implementations of getElementByClassName on the WWW.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top