Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
ASP .Net
ASP General
do we need id attribute??
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Bob Barrows, post: 4343185"] This is a matter of personal preference unless: 1. the element is in a form which you are submitting to an asp page, in which case the name attribute must be set in order for the receiving page to read its value. 2. the element is part of a group of elements which you need to refer to with a single identifier. In this case, you should use the name attribute for the grouping name, leaving the id attribute to be used for a unique name for each element in the group. Radio buttons and checkboxes are often created this way. Otherwise, it's really up to you. My personal preference is to use id to uniquely identify a single element on a page, and name for form elements and grouped elements. In script, I will always use the id to refer to a single element. This is an HTML/DHTML question and should have been asked in a more appropriate group (look for a group with "DHTML" in its name, or one of the ..scripting groups depending on which language you wish to use in your client-side script). ASP (server-side code) knows nothing about element names or ids. HTH, Bob Barrows [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
ASP .Net
ASP General
do we need id attribute??
Top