$('meta')returns a jQuery array object containing all three elements meta.
$('meta').data('status')returns the value of the attribute data-statusof the first element , and it works correctly.
However, $('meta').data('id')trying to read the data attribute idfor the first element, but it is not.
.
<meta data-status="stopped" data-id="0001" data-details="Example details"/>
, (, meta )
var status = $('meta').data('status'),
id = $('meta').data('id'),
details = $('meta').data('details');
- :
<meta data-status="stopped" >
<meta data-id="0001" >
<meta data-details="Example details" >
var status = $('meta[data-status]').data('status'),
id = $('meta[data-id]').data('id'),
details = $('meta[data-details]').data('details');