Tuesday, April 16, 2013

Calculate difference/sum of label values using jQuery

In this post, find jQuery code to calculate difference in label/span values. To fetch the label/span value don't use .val() or .text() method, Instead use .html() method.

Related Post:
$(document).ready(function () {
var nCost = $('#spnCost').html();
var nSellingPrice = $('#spnSellingPrice').html();
var nProfit = parseFloat(nSellingPrice) - parseFloat(nCost);
$('#spnProfit').html(nProfit);
});
See Complete Code
Feel free to contact me for any help related to jQuery, I will gladly help you.

No comments:

Post a Comment