Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would have posted this to StackOverflow but I'm currently unable to post questions there so I was wondering what is the difference between the ID section and the Name section on tags such as:

<input id="datepicker" STYLE= "background-color: #FFFF00">

and

<input name="CalendarField1" STYLE= "background-color: #FFFF00">

I was thinking it was to do with calling different tags in certain scripts like id being called by CSS and name being called by java or vice versa am I correct in thinking this or is there any other circumstances where you would use the name section instead of the id section or vice versa?

share|improve this question

closed as off-topic by slhck Jan 20 at 11:29

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is not about computer hardware or software, within the scope defined in the help center." – slhck
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Why couldn't you post in stackoverflow? That is something to be solved –  Jayan Jan 20 at 11:13
    
its a ban due to too many negative posts I don't really understand the point of banning on there but that's whats happened :/ –  Nathan Taylor Jan 20 at 11:15
1  
If you're banned from asking on one site, that doesn't mean you can ask questions on other sites where they're off topic. I see you're a fairly active member, so you should rather try and fix your existing posts on Stack Overflow (possibly ask for moderators to undelete deleted questions), edit them into better shape and possibly get them reopened. Continuing to post off topic questions on other sites however may get you quickly banned there as well. –  slhck Jan 20 at 11:30
    
why has this question been put on hold? it has a valid answer and I didn't think the question was off topic here scenes as there is a tag for it. Plus I've had other scripting questions that were supported here and I've tried my best to do what I can on SO but nothing seems to have any effect and when it does I get blocked again because my questions are considered "too newbee" –  Nathan Taylor Jan 20 at 13:36
    
@slhck is there a reason this is on hold? it has an answer and there is a tag for HTML and coding so I don't see how it is off topic? :S –  Nathan Taylor Jan 21 at 16:08

1 Answer 1

up vote 2 down vote accepted

The name is used when sending data in a form submission. Different controls respond differently. For example, you may have several radio buttons with different ids, but the same name. When submitted, there is just the one value in the response - the radio button you selected.

Of course, there's more to it than that, but it will definitely get you thinking in the right direction.

Reference

share|improve this answer
    
Ah so the Name section is only used in forms? –  Nathan Taylor Jan 20 at 11:10
1  
yes, you can also use same name for making an array in case of radio buttons. –  Kaushik Kishore Jan 20 at 11:11
    
Right I get it now thanks I was confusing myself with my own script so I need to quote the "ID" in my php scripts instead of the name right? –  Nathan Taylor Jan 20 at 11:13
1  
Especially, the id must be unique per document. It can be used for "internal" purposes such as <label for="datepicker"> or in CSS selectors #datepicker; also elements can be directly addressed by id, but not by name in JavScript. So the name is really just what is put into the form response (such as a GET form.php?CalenderField1=xy). –  Hagen von Eitzen Jan 20 at 11:14
1  
OK. You're welcome. But remember one thing Please don't post any question w/o doing some research or google. this will lead to odwn vote for your question. –  Kaushik Kishore Jan 20 at 11:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.