I am trying to do 2-3 calculations at once with jQuery. I found a link to a fiddle that did one calculation and I edited it to what I thought I needed to make it all work, but I can only get the one-off calculation to work.
Basically, I'm calculating the overall width and height of tires based on the metric sizes.
Example: 265/70R17 The width is calculated by dividing the 3-digit width (265) by 25.4 = 10.43
The height is calculated by taking the width in inches, multiplying by the ratio (70), then doubling that number before adding the size of the rim (17). So, ((10.43 * .7) * 2) + 17 = 31.60
Here's the link to the fiddle that I've been trying to make work.
http://jsfiddle.net/fY57T/
$('#rim').change(function(ev){
var twidth = $('#width').val() / 25.4;
var step1height = $('#ratio').val() * twidth;
var step2height = step1height * 2;
var theight = step2height + $('#rim').val();
$('#theight').html((theight).toFixed(2));
$('#twidth').html((twidth).toFixed(2));
});
Thanks in advance for any input anyone has.