JSFiddle - React, Tailwind, and code Playground

by jquerybyexample

HTML

Selling Price: <b><span id="spnSellingPrice">200.00</span></b>

<br/>
<br/>Actual Cost: <b><span id="spnCost">100.55</span></b>

<br/>
<br/>Net Profit: <b><span id="spnProfit" style="color:blue;"></span></b>

CSS

body {
    font-family:Arial;
    font-size:10pt;
}

JavaScript

$(document).ready(function () {
    var nCost = $('#spnCost').html();
    var nSellingPrice = $('#spnSellingPrice').html();
    var nProfit = parseFloat(nSellingPrice) - parseFloat(nCost);
    $('#spnProfit').html(nProfit);
});