Custom data attribute

noun

say it: “KUS-tum DAY-tuh AT-rih-byoot” /ˈkʌstəm ˈdeɪtə ˈætrɪbjuːt/

An HTML attribute starting with data-, such as data-product-id, that stores extra values on an element for scripts.

What is Custom data attribute?

Custom data attribute — An attribute beginning with data- that stores page-specific data on an element.

<button data-order-id="A1042">View order</button>

In a sentence

  • “Each button has a data attribute, data-product-id, so the script knows which product to add.”

Level: Journeyman · More HTML terms at this level

Updated