Id Naming Convention

When I give an item an id name so I can identify it easier - Wappler takes the hyphen out of the name. For instance, I create a section and name its id hero-value-prop. When I click off and back on it, the id is changed to herovalueprop.

I’m curious why this is? It seems the largely accepted convention is to use hyphens between words so that they can be easily identifiable in CSS and on the page. Thoughts?

The Id name needs to be a valid JavaScript variable name and there are no hyphens allowed there. Just use underscore to achieve the same effect.

Variables are used in expressions so if you use hyphen it can not be disqundished from minus sign

4 Likes

Good to know. Thanks!