Lets say I have this:
The short answer is that the syntax is this.dataset.whatever
.
Your code should look like this:
Another important note: Javascript will always strip out hyphens and make the data attributes camelCase, regardless of whatever capitalization you use. data-camelCase
will become this.dataset.camelcase
and data-Camel-case
will become this.dataset.camelCase
.
jQuery (after v1.5 and later) always uses lowercase, regardless of your capitalization.
So when referencing your data attributes using this method, remember the camelCase:
Also, you don't need to use commas to separate attributes.