From the comments under the question it appears that you want the loading spinner graphic (note: not a progress bar, the two are very different in behaviour) to appear while your long-running chemistry-related calculations run.
The issue you have here is that the calculations are a synchronous process and prevent the DOM from being updated while they are in process. To fix this you could place the calculation logic inside a timeout with a very short delay in order to give the DOM some time to update and not block the UI from being amended. As such, try this:
let $loading = $('#loading');
let $calcPpmAsCao3 = $("input[id$='txtCalciumPpmAsCaCO3']");
let $chloridePpmAsCao3 = $("input[id$='txtChloridePpmAsCaCO3']");
let ttlCationCaco3 = parseFloat($("input[id$='txtTdsAdjustmentForCation']").val());
let ttlAnionCaco3 = parseFloat($("input[id$='txtTdsAdjustmentForAnion']").val());
$("[id*=btnAddCa_Cl]").click(function() {
$loading.show();
setTimeout(function() {
// calculation logic here \/ \/ \/
if (ttlCationCaco3 > 0) {
$calcPpmAsCao3.val(function(i, v) {
return parseFloat(this.value) + ttlCationCaco3;
}).trigger('keyup');
} else {
$chloridePpmAsCao3.val(function(i, v) {
return parseFloat(this.value) + ttlAnionCaco3;
}).trigger('keyup');
}
// calculation logic here /\ /\ /\
$loading.hide();
}, 10);
});
#loading {
display: none;
}
There's a couple of things to note in this example. Firstly accessing the DOM is one of (relatively) slowest things you can do in JS. As such it's worth taking steps to reduce the number of times you do it. If you need to refer to an element multiple times, 'cache' it in a variable.
Also, call parseFloat() on a value once and store it in a variable. Then you don't need to keep calling parseFloat() on something which you already had access to.
Lastly, I used CSS to hide #loading by default. Don't do this in JS as the element will be visible for a split second before the JS runs and hides it. CSS executes first and is quicker, so it avoids this issue.