I was preparing a function in jquery to calculate the value of a variable based on selection of a radio button in a form.
Here is the fiddle
i was trying to do to calculate the value of javascript variable "calc_value" to show a value based on the selection of "rdOptin" radio button. But i am confused how to finish this.
I set the calculations but unable to implement it in jquery.
<form id="form1" name="form1" method="post" action="form1.php">
<b> Option 1:</b>
<input type="radio" name="rdOptin" value="norm" checked="checked" />Normal
<input type="radio" name="rdOptin" value="exp" />Expert
<br />
<b>Calculated Value:</b>
<div class="valueDisp">
<div id="calc_value">
</div>
</div>
JS:
var var1 = 50;
var var2 = var1 * 5 / 100;
var var3 = 20;
if (rdOptin == norm)
var calc_value = var1 + var2;
else if (rdOptin == exp)
var calc_value = var1 + var2 + var3;
Help needed friends.
Thanks a lot in advance.