$('input').each(function(i){
$(this).attr('value',val[i]);
});