How do you access data properties with jquery?

javascript
#1

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

#2

If your HTML is:

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

then you can call in a loop like this

$(this).data("test")

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