1
다음은 작동하고 있습니다. 수학 함수 A/B = C로 복제 된 3 개의 텍스트 필드. 완벽하게 작동합니다.입력 값 복제 설정
문제점 : 값이 실제로 텍스트 필드에 입력 된 내용을 읽도록 "키 업"에서 A, B 및 C의 텍스트 필드 값을 설정하고 싶습니다.
$("#math-table input").live("keyup", function(){
var id = this.id.match(/\d+/);
$("#C"+id).val(Math.round (($("#A"+id).val()/$("#B"+id).val()) * 100) + "%" );
$('#A1'+id).attr('value', ($('#A1'+id).val())); // NOT RIGHT?
$('#B1'+id).attr('value', ($('#B1'+id).val())); // NOT RIGHT?
$('#C1'+id).attr('value', ($('#C1'+id).val())); // NOT RIGHT?
});
var uniqueIds = $("#math-table tr").length;
$("#math-table input[id^='B']").live("change", function(){
var $thisRow = $(this).closest("tr"),
$clone = $thisRow.clone(), // Clone row
$inputs = $clone.find("input").val("");// Reset values, return all inputs
uniqueIds++; //Increment ID
$inputs[0].id = "A" + uniqueIds;
$inputs[1].id = "B" + uniqueIds;
$inputs[2].id = "C" + uniqueIds;
$thisRow.after($clone);
});
[jsFiddle] (http://jsfiddle.net/) 도움이 될 것입니다. – sczizzo
확실히 감사합니다! http://jsfiddle.net/CzZxf/ – user1040259