I'm trying do to add some data attributes to a DIV, but this attribute has to be a variable.
Example:
- var HEIGHT = window.innerHeight; // 740
- $('div').attr('data-' + HEIGHT, 'value');
So the DIV should look like:
- <div data-740='value'></div>
Every time I try to do this, I just don't get it to work, or I get the Variable name on the attribute.