Go ahead and use an attribute for this, but use a data- prefix on it. Attributes with the prefix data- are explicitly allowed on all elements as of HTML5. Example:
It works today in all browsers, and because it's now specified behavior, it's future-proofed.