I have code :
function compute() { if ($(\'input[name=type]:checked\').val() != undefined) { var a = $(\'input[name=service_price]\').val();
Cast them to a Number
$('#total_price').val(Number(a)+Number(b));
But before you do that
if (!isNaN($('input[name=service_price]').val()) {...