JSFiddle - React, Tailwind, and code Playground
by Kamal Agarwal
HTML
<input type="text" name="width" class="width" placeholder="" />
<input type="text" name="width_feet" class="width_feet" placeholder="Feet" />
<input type="text" name="width_inches" class="width_inches" placeholder="Inches" />
JavaScript
jQuery('.width_feet, .width_inches').change(function() {
var feet = jQuery('.width_feet').val();
var total_inches = 0 ;
if(feet > 0)
total_inches = (feet * 12)
var inches = jQuery('.width_inches').val();
if(inches > 0)
total_inches = total_inches + parseInt(inches);
var mm = total_inches * 25.4;
jQuery('.width').val(mm);
});