How do you access data properties with jquery?


Struggling to use jquery to loop through and access values from data properties from HTML.


If your HTML is:

<a data-test="123">Jordan</a>

then you can call in a loop like this


This will return 123

Notice that “test” in the second block of code matches up with the -test part after data in the first block