I have got this script which multiplies value inputted into input field by dropdown's value assigned through span data-val.
How can I make the script show result rounded up to 3 decimals?
$(document).ready(function () {
function showTab(name) {
$('div.fruit').hide();
var $div = $('#' + name).show();
var number = parseInt($('.number').val(), 0);
$('span', $div).each(function () {
$(this).text($(this).data('val') * number);
});
}
$('#update').click(function() {
showTab($('#dropdown').val());
});
showTab($('#dropdown').val());
});