JSFiddle - React, Tailwind, and code Playground
HTML
<input type="radio" id="inches" name="increments" value="inches">
<label for="radio">inches </label>
<br>
<input type="radio" id="cm" name="increments" value="cm">
<label for="radio">cm</label>
JavaScript
// Define the vars so they can be set from inside the setValues function
var mesure,
handInches,
thumbInches,
thumbBase,
palm;
// Setting some default values since they wherent defined in your example code
var handCircumference = 10,
thumbCircumference = 10,
thumbBaseToIndex = 10,
thumbBase = 10;
// Set the values based on the selected radio button value
var setValues = function(val) {
if (val === 'inches') {
measure = "inches";
handInches = parseFloat(handCircumference) * 2.5;
thumbInches = parseFloat(thumbCircumference) * 2.5;
thumbBase = parseFloat(thumbBaseToIndex);
palm = (Math.round(thumbBase - .5) * 2 / 2).toFixed(1);
} else {
measure = "cm";
handInches = parseFloat(handCircumference);
thumbInches = parseFloat(thumbCircumference);
thumbBase = parseFloat(thumbBaseToIndex);
palm = (Math.round(thumbBase - 1.25) * 2 / 2).toFixed(1);
}
};
// Event to fire off the setValues function once the radio buttons are selected/changed
$('input[name="increments"]').change(function(){
var val = $(this).val();
setValues(val);
alert('The selected measure is: ' + measure);
});