JSFiddle - React, Tailwind, and code Playground
by slawe
HTML
<p data-sentence="This is the program">jedan</p>
<br/>
<h6 data-sentence="This is the test">dva</h6>
JavaScript
/* var result=document.querySelectorAll('[data-sentence]');
for (var index in result){
if (result.hasOwnProperty(index)){
console.log(result[index].getAttribute('data-sentence'));
}
} */
$('[data-sentence]').each(function() {
var element = $(this);
// Do something with the element
console.log(element.html());
});