How to get the data-id attribute in jquery and javascript?
August 8, 2022 · 2 min read
This tutorial shows the way to get data attribute values in Javascript and jquery with examples. data-attributes are used to store the custom data to an HTML element. It can be applied to any valid HTML element including div, span, input, and buttons. data attributes are defined with valid syntax. <element data-{validstring}=value> validstring is a small case string, the “currentAge” string is not valid currentage is valid. value can be any number or string....