In plain old JavaScript you can get the data attributes of

[code language="html"] <div id="test" data-news-item-id=3>lorum ipsum</div> [/code]

like this

[code language="javascript"] document.getElementById('test').getAttribute('data-news-item-id'); [/code]

But did you know there's a alternative way of doing this by reading an element's dataset property?

[code language="javascript"] document.getElementById('test').dataset.newsItemId; [/code]

Notice that the values can be accessed by camelcasing the name of the data attribute. You can also write to datasets to change values of data attributes. Read the informative helpful article on MDN to know more.