Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 227163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:34:32+00:00 2026-05-11T19:34:32+00:00

This is related to naming conventions for a DOM element’s id attribute and I

  • 0

This is related to naming conventions for a DOM element’s id attribute and I guess the name attribute as well. When it comes to JavaScript, from what I understand and have done is always use camel case except for the names of classes. Classes are Pascal cased.

Having said that I develop in ASP.NET mainly and here’s where I run into a naming issue for the id attribute. In ASP.NET if you drag and drop a new server control to a page(which I rarely do, I’m a type the markup kinda guy), the default names are always Pascal cased because they need to conform to the .NET framework naming guidelines for server-side code.

So when it comes to naming the id attribute of ASP.NET server controls or just elements in markup, I follow the rule to camel case the id attribute (Javascript naming guidelines), but this conflicts with the .NET naming guidelines.

So, one, what casing do you folks normally do for the id attribute in DOM elements and two what do the .NET folks who develop in ASP.NET do for naming the id attribute?

On top of that when I’m creating form elements in markup, I generally use Hungarian notation for text inputs, like

<input type="text" id="txtUserName" />

or for checkboxes like

<input type="checkbox" id="chkSelectAll" />

Which definitely goes against .NET server-side code naming guidelines and maybe JavaScript guidelines as well.

Any advice is much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:34:32+00:00Added an answer on May 11, 2026 at 7:34 pm
    • Keep it semantic. Use complete, simple, (preferably English) words. Don’t try to come up with something fancy or technical, and don’t describe what it is – we know that. Describe what it does. Describing purpose adds informational value.

    • Don’t abbreviate anything! BW_RCB01_SW meant something to the team who did our CSS to years ago, but it doesn’t mean anything to me now and I have to work backwards to try to translate what BW_RCB01_SW corresponds to for my purposes, and either remember that translation or document it somewhere. Better? blackwhite-boxtype1-bottomleft. It’s longer but also doesn’t require a Rosetta stone.

    • Keep it all lower-case and use underscores or hyphens. I prefer hyphens, but that’s totally a preference. There should be no impediment to using hyphens, since they are not reserved in CSS or HTML and IDs are treated as literal strings in every other language. Lower case is all experience – too many hours wasted wondering why the heck won’t this style apply oh. pageContainerLeft is not the same as pageContainerleft.

    • Identify exactly what that element is, but no more. Think seriously about each piece of information you’re embedding in the name and whether it’s necessary. In your example – do you need to know it’s a checkbox by the ID? Unlikely. You already know what element you’re referring to because it’s a unique ID and you have to code against that element anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is related to a chapter from beautiful code . And in that chapter
Related to this question , what is the best practice for naming a mutex?
The answers to this related question of mine lead me to choose Java for
I found this related question: How do I use composition with inheritance? I would
This is related to the accepted answer for What’s your #1 way to be
This is related to the this question and the answer maybe the same but
This is related to some other questions, such as: this , and some of
(This is related to Floor a date in SQL server .) Does a deterministic
This is related to a question I asked the other day on how to
This is related to this question . I'm writing a Flex app (a WindowedApplication)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.