EDITED
Thank you for everyone who offered support... the best working script I will share with you in hope that I could help others who is looking f
You have few problems,
Fixed you code
Live Demo
HTML
Javascript
$("#btnCal").click(function() {
$("#rate").val(function() {
var result = parseInt($("#price1").val()) * 100 / parseInt($("#price2").val());
if (!isFinite(result)) result = 0;
return result;
});
});