Welcome Guest, Not a member yet? Register   Sign In
what name spacing to use for div id's and classes?
#11

[eluser]CroNiX[/eluser]
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.
#12

[eluser]jmadsen[/eluser]
Yeah, I think something is backwards here.

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

"data-mytable_id"

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

#13

[eluser]webmastergrumpy[/eluser]
No clear answer yet.

JQuery uses - in class names

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

[eluser]LuckyFella73[/eluser]
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.

http://stackoverflow.com/questions/16968...underlines

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 "_").




Theme © iAndrew 2016 - Forum software by © MyBB