Tag Id

S

shapper

Hello,

When should I give an ID to a tag?
Only if I want to refer it?

And is there any type of tags that should always have an ID? Inputs
for example?

Thanks,
Miguel
 
R

rf

dorayme said:
I wonder if OP reads posts on this group? There was a thread
recently:

http://tinyurl.com/2xfcmq

or does he *just* use the ng to ask questions?

Typical of google groupers. They don't know that google can also be used to
<shudder>search</shudder> for stuff.

Fishes and fishing come to mind.

The required effect is for the OP to do some of his own homework :)
 
A

Adrienne Boswell

Gazing into my crystal ball I observed Blinky the Shark
Corollary question: what's the best -- id or name? Or does that just
depend? If the latter, on what?

In a form it makes a lot of difference.

I can have:
Which one does not belong?
<input type="checkbox" id="field1" name="field" value="dog"> Dog
<input type="checkbox" id="field2" name="field" value="cat"> Cat
<input type="checkbox" id="field3" name="field" value="handbag"> Handbag

I can get to the different radios using their id values. But if all are
checked, then server side I will get field=dog, cat, handbag. Since
handbag is not an animal, then I could style field3 to alert the user
they had made a mistake.

Further, id can be used on almost any element, where name can only be
used on a few. I can put an id on a h2 element, but not a name, eg. <p>
The one thing I enjoy shopping for most is <a href="page.html#shoes"
title="Find out more about shoes">shoes</a>.</p> could go to <h2
id="shoes">Shoes</h2>
 
B

Blinky the Shark

Adrienne said:
Gazing into my crystal ball I observed Blinky the Shark


In a form it makes a lot of difference.

I can have:
Which one does not belong?
<input type="checkbox" id="field1" name="field" value="dog"> Dog
<input type="checkbox" id="field2" name="field" value="cat"> Cat
<input type="checkbox" id="field3" name="field" value="handbag"> Handbag

I can get to the different radios using their id values. But if all are
checked, then server side I will get field=dog, cat, handbag. Since
handbag is not an animal, then I could style field3 to alert the user
they had made a mistake.

Further, id can be used on almost any element, where name can only be
used on a few. I can put an id on a h2 element, but not a name, eg. <p>
The one thing I enjoy shopping for most is <a href="page.html#shoes"
title="Find out more about shoes">shoes</a>.</p> could go to <h2
id="shoes">Shoes</h2>

Ah! I did not know that name could not be used with some elements that
accept id.

Thanks, Adrienne.
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top