Interview Question

What are custom data attributes?

Custom data attributes store small page-specific values on elements.

💡 Concept ✅ Quick Revision 🌐 HTML

Answer

Custom data attributes are `data-*` attributes made for page-specific values. • They are valid on normal HTML elements. • JavaScript can read them through `element.dataset`. • Use them for small public values, not secrets.

💡 Simple Example

<li data-level="beginner">HTML Basics</li>

⚡ Quick Revision

Custom data attributes store small page-specific values on elements.