为什么这段代码只重复获取第一个数据属性?
HTML
<ul class="als-wrapper">
<li class="als-item"><a data-loc-subject="test value"><img src="http://www.ikea.com//us/en/images/products/pugg-wall-clock__13080_PE040801_S4.jpg" height="100" width="100"/></a>test value</li>
<li class="als-item"><a data-loc-subject="a second value"><img src="http://www.ikea.com//us/en/images/products/pugg-wall-clock__13080_PE040801_S4.jpg" height="100" width="100"/></a>a second value</li>
<li class="als-item"><a data-loc-subject="a third value"><img src="http://www.ikea.com//us/en/images/products/pugg-wall-clock__13080_PE040801_S4.jpg" height="100" width="100"/></a>a third value</li>
</ul>
jQuery
$( ".als-item" ).click(function(e) {
e.preventDefault();
var data = $('.als-item a').data('loc-subject');
alert(data);
});