MDN self-hosted library · e01.org
data-* / notebook

data-*

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

html
<math>
  <msup data-formula="euler" data-value="-1">
    <mi>e</mi>
    <mrow><mi>i</mi> <mi>π</mi></mrow>
  </msup>
  <mo>+</mo>
  <mn>1</mn>
  <mo>=</mo>
  <mn>0</mn>
</math>
js
const msupElement = document.querySelector("msup");
console.log(msupElement.dataset.formula); // "euler"
console.log(msupElement.dataset.value); // "-1"