I need to be able to define the fact that a board game tile like this one has a city on the top edge, roads on the left and bottom edge, and grass on the right edge.
How can I do this? From what I’ve read about HTML5 custom data attributes they seem like a viable option (e.g., “data-left=’road’…”), but I am hoping to receive confirmation from someone with more coding experience before getting too far into the project. Any thoughts?
You can use custom attributes like toske said, but I would recommend that you create a data object model representation (using JSON) of your scenario and them process this model to render your interface.
Edit: Here is an example. The data is the tiles array that contains some objects that represents each tile. I used jQuery, but you can use the JavaScript library that you want. I recomment that you learn jQuery if you don’t know how to use it. It’s a very powerfull and simple library.