In jQuery I can create a HTML element with data:
$(\'\').data(\"field\", { i: i, j: j }).appendTo(\"body\"); <
With .dataset:
document.querySelector('button').dataset.field
This isn't supported in all browsers, so you may need to find a polyfill (or use jQuery).