I realize my title isn't perfectly clear, but I couldn't come up with a better one. So here goes:
I work on an e-commerce website where different products should have different maximum order ammounts. Since writing plugins for the CMS is not really an option, I want to solve this with javascript.
What I want to do:
- Check wether a div with the class "order-limit" exists
- Read that divs data-limit-attribute, which contains a number
- Add a sentence including the number
Now today I read http://danwebb.net/2010/1/27/put-that-data-attribute-away-son-you-might-hurt-someone which basically said:
Don't use data-* attributes for javascript.
So now I wonder: What's the best practice to do what I did, given that products have different upper limits?
hrefand hidden fields). It should be used when the data is semantically relevant to the element.