JSFiddle - React, Tailwind, and code Playground
by Amar Nyayapati
HTML
<input type="textbox" id="val1">
<select id="cal">
<option value="1">*</option>
<option value="2">+</option>
<option value="3">-</option>
<option value="4">/</option>
</select>
<input type="textbox" id="val2">
<input type="submit" id="calc" value="calculate">
<script>
$("#calc").click(function(){
var sol;
var v1=parseInt($("#val1").val());
var v2=parseInt($("#val2").val());
var cal=($("#cal").val());
if(cal == 1){
sol = v1*v2;
alert("Result is:" + sol);
}
else if(cal == 2){
sol = v1+v2;
alert("Result is: "+ sol);
}
else if(cal == 3){
sol = v1-v2;
alert("Result is: "+ sol);
}
else if(cal == 4){
sol = v1/v2;
alert("Result is: "+ sol);
}
else
alert("wrong choice");
});
</script>