JSFiddle - React, Tailwind, and code Playground
HTML
<div class="form">
<label for="units">Units:</label>
<input type="text" name="units" id="units" value="12" class="required digits" />
</div>
<div class="form">
<label for="from">Convert From:</label>
<select name="from" id="from">
<option value="degC">-Select an Option-</option>
</select>
</div>
<div class="form">
<label for="to">Convert Into:</label>
<select name="to" id="to">
<option value="degF">-Select an Option-</option>
</select>
</div>
<div class="form">
<label> </label>
<input type="submit" name="submit" value="Convert!" />
</div>
JavaScript
$('input[name="submit"]').click(function(){
var c = new Convert();
alert(c.convertThem());
})
function Convert(){
this.from = $("#from").val();
this.to = $("#to").val();
this.units = $("#units").val();
}
Convert.prototype.convertThem = function(){
if(this.from == "degC"){
if(this.to == "degF"){
return this.units * 1.8 + 32;
}
}
}