JSFiddle - React, Tailwind, and code Playground

by andig2

HTML

<div>1</div>
<div>2</div>

JavaScript

$('div').each(function(){
    $(this).attr('id', $(this).text());
    $(this).data('cost', $(this).text());
});

$('div').each(function(){
    $(this).attr('id', $(this).text());
    console.log($(this).data('cost'));
});

console.log($('div'));


var e = $('div').filter(function(){
    console.log("cost: "+$(this).data('cost'));
    return +$(this).data('cost') > 0;
}).get();

console.log(e);