objectivehtml / Google-Maps-for-Craft

The complete geolocation toolkit for Craft CMS.
Other
94 stars 20 forks source link

Map ID does not accept numbers #30

Closed annieneel closed 9 years ago

annieneel commented 9 years ago

The site I'm building has a potential for multiple maps on one page. I was going to use the block ID as the id - but numbers do not work as the id. I appended a 'm' on the front of the id, but that's not 100% ideal.

id: 'm123'

works while

id: '123'

does not.

objectivehtml commented 9 years ago

That id refers to a Javascript variable. So that id string becomes the name of a global variable to reference in the DOM. In Javascript variables cannot be just numbers and must be started with a letter or approved special character. Given that twig allows to you easily concatenate strings to create dynamic id's, how is this not ideal?