var rm0 = 0; var rm1 = 100; var rm2 = 150; var rm3 = 50; $("input:checked").each(function(i){ var rrr = eval('rm' + i); $(this).val(rrr); });