• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what name spacing to use for div id's and classes?

But to the original posters question, it doesn't matter how you name your html attributes, just as long as they are valid and they makes sense to your application and maintaining it.

Yeah, I think something is backwards here.

Working with "data" attributes, for example , standard naming is:


No hyphens in variable names; use underscores. Hyphens are fine in class & id & attribute names.

No clear answer yet.

JQuery uses - in class names

so id's with underscore and class names with - ?

Aken posted:
Quote:This is backwards. Javascript prefers underscores.

The most widely accepted, unofficial standard is to use underscores in IDs, and hyphens in class names.


Beyond that, the naming conventions are your own personal preference.

Isn't that clear? I prefer to name my classes and ids the same way and
never had a problem using javascript yet (caused by "-" or "_").

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.