I have a string in JavaScript application:
const articleBody = "<div class=\"article\" data-id=\"123456\" data-title=\"Some long article title\">Article content goes here.</div>"
There is no way for me to set this as HTML and then get data- values as I would normally do, so I need to "extract" data- attribute values from string. In the end I need to have something like that:
const id="123456"
const title="Some long article title"
How would I do that with JavaScript?
Thank you!