JSFiddle - React, Tailwind, and code Playground

by Mohamed Amer

HTML

<label class="price">100</label>
<label class="price">200</label>
<label class="price">300</label>
<label id="total"></label>

JavaScript

jQuery(document).ready(function($){
    var total = 0;
	$('label.price').each(function(){
        var value = parseFloat($(this).text());
        total += value;
    });
    $('#total').text(total);
});