You seem to be overwriting even the value of the textbox that generated the event..
Replace
$('#' + x).val(z / valx);
with
$('#' + x).not(this).val(z / valx);
EDIT
The reason is you are always reading the value from
var valx = parseFloat($(this).attr('data-val'));
instead of
var valx = parseFloat($(this).val());